Saving form data to a table

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

I'm using a dlookup to pull city and state from a ZipCode
table using a textbox control source (=DLookUp
("[City]","ZipCode","[Zip] = Form![Zip]").

My question is what is the code I would use to save the
City displayed in the form to City field in the form's
main table.


Thanks!!
 
1) Don't! You shouldn't need to store anything you can calculate.

2) Some zip codes incorporate more than one city. The post office usually uses the main
city as the address but will accept the actual city as well. If you want to store the
correct city, then bind the control to the field in the table. Set the default value to
the DLookUp that you already have or (probably) set the AfterUpdate event of the zip code
control to set the value of the city control to the DLookUp statement. This would make the
value returned by the DLookUp a "default" but would allow you to change it and store it.
 
Back
Top