Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to grap Default View from Previous Record In a Form 3

Status
Not open for further replies.

AcquisitiveOne

Technical User
Nov 28, 2000
55
US
We are using barcodes to track materials. I need to be able to scan them real quickly and assign a location to the items. Usually when the items are scanned together they are all placed in the same location. So I have a drop down box with the names of the different areas of the warehouse. I would like so set up the for so when the user first opens the form he assigns a location and scans the first barcode. After that the location stays as the default value so that the user can just keep scanning without having to manually go to the combo box and keep putting the location for each item scanned. Please Help!!! I was thinking that maybe you have to grab the default value from the same Field from the Form (record) before the new record so that it will grab the last location used but I dont know how to write the expression.
 
Easy! I just had to do this today, in fact.

In the combo box's AfterUpdate event, put:
Me!cboLocation.DefaultValue = Me!cboLocation.Value
Rick Sprague
 
Could you please explain exactly how to enter this in the name of the form is called Check In. The Combo Box within the form and table is called ID. I copied and pasted what you told me to put in but i didnt work. Then i was looking a the cbolocation and so i tried to put the location of the combo box but that still didnt work. Could you please explain a little bit more detail. What is the Me! for what does it represent. Let me know if you need any more Information. Thx for your help.:)
 
For "cbolocation" substitute the actual name of your combo box:
Me!ID.DefaultValue = Me!ID.Value

Me is a keyword that, within a form module, refers to the form itself. Me!controlname refers to a control on the form. Thus Me!ID refers to the control named ID on the current form.

What the statement does is copy the data in the Value property of your ID control (i.e., the data that's displayed in the combo box's text box part) to that control's DefaultValue property. Every time you go to the "new" record at the end of the recordset, Access automatically copies the data in the DefaultValue property to the combo box.

By putting the statement in the combo box's AfterUpdate event procedure, you're setting the combo box's default value to whatever the user just keyed in or selected. Every time they key something else in, or select another value from the list, it becomes the new default value. Rick Sprague
 
Thx Rick that worked great i was trying to put it in the expression builder but figured out you had to put it in the module. I need to learn more about those. But Thx you very much once again!! :)
 
Sorry for the confusion. Being a programmer, I tend to assume everyone uses VBA code for this sort of thing.

You could use a macro, though. Use a SetValue action, with the arguments set as follows:
Item: [Forms]!<formname>![ID].[DefaultValue]
Expression: [Forms]!<formname>![ID].[Text] Rick Sprague
 
Rick one last question. When I use the formula in a date data type field and when it goes to the new record the default date is always 12/30/99. Is there a different formula for dates. For example when I input 2/1/01 in the date field for my first entry and then go to a new record on the form the new form defaults to 12/30/99. I must be doing something wrong. All the other default data works fine its just the date fields that will not default over to the next record. Please Help once Again!

Thx,
Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top