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

Automatically inputting data into text box based on selection of combo

Status
Not open for further replies.

Kingsteveiv

Technical User
Oct 8, 2001
20
US
I have 2 tables that are unrelated.

Table 1 - Address

Location / Address / City / State
AA 1234 Denver CO
BB 5678 Chicago ILL

Table 2 - Route

Stop 1 / Stop 2 / Stop 3 / Dist

in order to fill the fields in table 2 (stop 1, stop 2, stop 3), i created a form, based on table 2, that imputs the data into the stop 1, stop 2, stop 3 fields of table 2 according to a combo box that pulls formation from the location field of table 1. my question is, if on the form when i select the location from a combo box, how can i get it to automatically input the addresses of the location selected from the combo box into the form for a caluculation for DIST in table 2. I do not need the address to be in table 2, i just need the DIST calculation.

I cant seem to do this with a query since neither table has any related
fields. Please help!!!
 
There are a number of things you could do but one suggestion is to create a DLookup function in the Control Source of the DIST field. The function would look something like this (you supply the Formname):

=DLookup("[Address]","Table1","[Location] = [Forms]![Formname]![Combo1]")

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top