Results 1 to 6 of 6
  1. #1
    AMJADJ is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Jul 2018
    Posts
    34

    Default Value of a field in the form

    Hi

    I have a simple form which is used for data entry to record what is being loaded onto a vehicle. The user has 3 fields to enter, vehicle id, storage and number of pallets. The form is completed once a vehicle has been loaded, therefore you wont fill the details of two vehicle loads at the same time.

    The issue I want to remove is that at each line, the user has to type in the vehicle id for each record. Is there anyway I can initially ask the user what the vehicle ID is and then use this value as the default value to the form field for each line?

    Hope this makes sense
    Thanks in advance.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    There may be more to the set up than described. Can you give us a little more detail--- a day at your business type thing?
    Do you need/use/report?
    LoadDate
    LoadedBy

    If you had a tblVechicle with
    VehicleID PK
    VehicleMake
    VehicleOtherDetails...

    You could have VehicleID as a prepopulated Combobox on your form. User selects the vehicle from the combo (prevents retyping and typos).
    You could have another combo with numbers 1--XX and user selects from that combo (number depends on typical range of pallet numbers).

    What else is on your form?

    Good luck.

  3. #3
    AMJADJ is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Jul 2018
    Posts
    34
    Hi "Orange"

    Thanks for taking the time out to respond.

    It is just a basic data entry form with 3 fields that then populate a table. The vehicles that load the pallets are from external companies and therefore there are no set numbers that can be populated into a table and then a combo box being used. So in the morning we could have a vehicle number 1234 where we load 6 different orders onto. One entry will be order number, vehicle number, number of pallets and whether it is for storage or delivery. The then next line will be a different order number, same vehicle number, no of pallets and storage or delivery and so on.

    For each line on the form currently, the user has to enter the vehicle number again also this will be the same for each line, however the next vehicle that requires loading might be 5678, the same info is required however the user will have to type in 5678 again for each line.


    I was wondering if there was a way where the user enters 1234 or whatever the vehicle number is ONCE, and then for each new line, it takes this value as a default.

    I did create a table with one field called vehicle number, one form where the user enters the vehicle number (thus populating this tables field) and then make the vehicle number on the other form = the value of this field in the table (if that makes sense)! but not sure how to make this work.


    Hope this provides greater understanding, once again, thanks for your time.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    What do you do with the data after it is collected? Reports? Statistics? Invoices?
    You can store the Vehicle number entered into a variable, then use that variable to assign values to the records you store/save.

    Where does the OrderNumber come from? If you have a list of Orders, you could put those in a combobox so user could just Select without retyping.

    Starting to sound like you are dealing with

    External Company
    Order
    Load
    Pallet
    LoadType (Delivery/Storage)
    and you may need
    DeliveryLocation and/or StorageInfo.

    I helped someone a while back with similar subject matter. (doesn't deal with delivery)
    Here is the data model we set up. (Your set up may be different)
    Click image for larger version. 

Name:	LoadsAndPallets.jpg 
Views:	14 
Size:	44.1 KB 
ID:	34712

    I'm heading out for the rest of the day, but others are here to assist.

    Good luck with your project.

  5. #5
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by AMJADJ View Post
    It is just a basic data entry form with 3 fields that then populate a table.
    You said the fields are "vehicle id, storage and number of pallets". (I hope you didn't use spaces in the field names)
    You don't have the date and time a truck was loaded?
    Oops, then I see
    One entry will be order number, vehicle number, number of pallets and whether it is for storage or delivery
    Now it is 4 fields.


    From Post #3
    Quote Originally Posted by AMJADJ View Post
    I did create a table with one field called vehicle number, one form where the user enters the vehicle number (thus populating this tables field) and then make the vehicle number on the other form = the value of this field in the table
    So now you have the vehicle number in a text box in the form header of the data entry form.
    Have you thought about using the (data entry) form before update event to get the vehicle number from the text box control in the header and put it in the vehicle ID text box control in the detail section?

    The code might look like
    Code:
    Private Sub Form_BeforeUpdate(Cancel As Integer)
        Me.tbVehicleID = Me.tbVehicleNumber
    End Sub
    (you could also add code to ensure that the vehicle number text box in the form header is not null)
    where Me.tbVehicleNumber is the text box control in the header that has the vehicle number (from the table)
    and Me.tbVehicleID is the text box control in detail section that is part of the record with the vehicle id, storage and number of pallets.

  6. #6
    AMJADJ is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Jul 2018
    Posts
    34
    Hi Steve

    It is a work in progress, hence why 3 to 4 fields

    This is exactly what I wanted, thank you sooo much for your time and assistance - Top Man!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 11-06-2017, 02:45 PM
  2. Set Default field in a form
    By rebfein in forum Forms
    Replies: 3
    Last Post: 09-13-2016, 11:37 AM
  3. Form in which each field is a default value.
    By Abacus1234 in forum Forms
    Replies: 3
    Last Post: 12-12-2015, 01:51 PM
  4. Set table.field default from a form.
    By Thompyt in forum Access
    Replies: 6
    Last Post: 10-30-2014, 02:47 PM
  5. Form Field Default Setting
    By roofbid in forum Programming
    Replies: 3
    Last Post: 12-17-2010, 10:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums