Saving form data to a table

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!!
 
W

Wayne Morgan

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Form help 4
zipcode lookup table-Access 2007 4
error 2489 1
data entry on form 1
Zip Code Lookup? 1
Using DLookup on Form 3
Dual tables in form 4
dlookup results not visible on form 2

Top