Macro

  • Thread starter Thread starter Té
  • Start date Start date
T

Té

I have a table that contains Cities and States along with their zip codes.
How can I set up a macro where I enter a zip code in a form it automatically
puts in the cities and states?
 
Té,

If you are talking about the City and State being written, via bound
controls on the form, into fields in the table that the form is based
on, then the answer is that this is basically an invalide thing to be
doing in a relational database. You already have the master table with
all the zip codes and their associated cities/states, and this is the
*only* place this data should be stored in your database.

If, on the other hand, you are talking about the *display*, from the
user-friendly point of view, of the city/state information related to
the zip code entered, then this is most understandable, and a common
requirement. There are a number of approaches that can be taken in this
situation. There is a discussion of the options in this article:
http://accesstips.datamanagementsolutions.biz/lookup.htm

I think in the scenario you have mentioned, I would prefer the first
method 'Query' in that article, which would involve adding the
zip/city/state table to the query that the form is based on, joined to
the existing table on the Zip field, which gives you direct access to
the related city and state onto the form.
 
Hi Bonnie,
So do I copy that code into the on exit on my form? I'm new to Access,
and I am just learning about macros.
 
Back
Top