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

DLookup

Status
Not open for further replies.

jkslc

Technical User
Nov 23, 2003
4
US
Hello All,

I have created a query of containing the following fields: JobID, FirstName, LastName, Address, City, State, Zip. I want to create a form that when a user enters a job# in the JobID field, the rest of the fields are automatically inputed with data using the query data. When I put a Dlookup formula in the criteria section of the query, re-open the form, it asks me to enter a job#, I do so, and the information in the form is there...Works great, but I want have the abilty to enter the job# on the form and have the same result>>> DATA....


 
Hi

Forget DLookup.

Create a combo box, based on the query you mention, include all of the columns you want to have populated in teh form in the combo box, if you do not want user to see them, set column width to 0

If the columns you want to populate are bound columns, in the after update event of teh combo box put code like so

FirstName = cboJobId.Column(1)
LastName = cboJobId.Column(2)
Address = cboJobId.Column(3)
City = cboJobId.Column(4)
..etc

using your own control names of course, note you reference the columns of teh combo box using the .Column() property, rembering that teh first column is .column(0)

If the columns you want to populate are not bound columns on the form, then set their source to =cboJobId(1)... etc and forget about the above mentioned code in the after update event

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top