enter city and state

M

myxmaster

Hi,
I have a Zip code table with city, state and Zip. I would like the
user to enter the zip on the form and automatically populate the city
and state fields.Also as new areas are growing rapidly if the zip is
not in the database I would like the user to be able to add the
information. I realize these 2 point are probably the Dlookup and not
in list procedures, however I have been trying for days now to no
success.
TIA
 
G

Guest

You can use the 'on lost focus' to trigger the action. Create the event
procedure and select 'code builder' to create VB subroutine.

in VB sub you type:

Myzip = me.txtzipcode
MyCity = dlookup("city","tblzip","zip = myzip")
me.txtcity = Mycity

if this still doesn't work, try to add:
me.txtcity.requery

Hope this helps.
 

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


Top