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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access 2000 Lookup Values

Status
Not open for further replies.

mxp346

MIS
Apr 27, 2002
50
0
0
US
I have two tables. I made a form where the person types in an ID number for an instance. I want the form to look in the one table and pull the information that goes with the ID entered by the user. The user should be able to open the form and type an ID in, then the statement =DLookUp("[EventDesc]","[tblEvent]","[EventID] = Form![txtID1]") that I put in the control source of the text field pulls information into that field. The statement works if I set the ID default value to one of the ID's in the table but that's not very helpful. Then if there is no default value and I enter a value into the form, the text box with the lookup statement doesn't do anything, the field stays blank. Is there a way I can get the text field to lookup the information after the user types in an ID?
 
Instead of using DLookUp, try putting your input field on an unbound form with the result field as a subform that has the table as the record source and link the subform to the main form.
 
In the AfterUpdate event procedure for the ID field on your form enter: "Me!LookupControl.requery ", where LookupControl is the name of your lookup control.

gilave
PNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top