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

How do I fill in multiple fields?

Status
Not open for further replies.

walkert

IS-IT--Management
Sep 7, 2001
17
0
0
US
I would like to fill in the "City" and "State" fields when I put in the zipcode. I have a table created with the zipcodes in it. (3 fields,zip,city,st.)

How do I make it fill in?
 
How many tables you have in your database file?

If it is one table I think you can't do it.

But if you created two tables like: tbBASE & tbMOVMENT
and zipcode is primery key in tbBASE and many in tbMOVMENT
it is possible to get what you want.

mtomar@msn.com
 
Maybe on the lost_focus, after_update or exit event of the zip code you could use the DLookup Function.



Private Sub Zipcode_AfterUpdate()
txtCity.Text = DLookup("[City]","tblZip","[ZipCode] = '" & txtzipcode.text & "'"
txtState.Text = DLookup("[State]","tblZip","[ZipCode] = '" & txtzipcode.text & "'"
End Sub


I did not run this but I think this might be what you want.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top