choosing a table

  • Thread starter Thread starter McDonald
  • Start date Start date
M

McDonald

I have a table with fields autonumber, Cities, zipcodes, and counties, I
also have a table states with autonumber, full and abbreviations. I need to
create a relationship between them and then on a form, be able to type in a
zip and have it fill in the rest of the text boxes or vice versa. Also on a
form, I don't know how to deviate from the table I started the form with.
how do I choose another table.
 
Second question first: Open the form in design view. Open the Properties sheet and go to
the Data tab. Change the Record Source line.

First question: In the AfterUpdate event of the zip code text box place something like:

Me.txtCities = DLookup([Cities], "TableName", "[zipcodes] = '" & Me.txtZipcode & "'")

Do this for the other controls as well. The quotes are placing a single quote around the
value of the zip code because the zip code field is usually treated as text, not numeric.
If your's are numeric, you'll need to remove the concatenating of the single quotes.
 
Back
Top