HOW DO I GET A FIELD TO AUTOMATICALLY FILL IN?

B

Bryan Bloom

I have a form called "New Order Input Form". On that form, the user selects
the zipcode from a combobox field called "Delivery Zip Code". This field has
a row source of a query called "qryZipCodes".

On the same form I have a field called "Delivery City". I want Delivery
City to fill in automatically based on what the user chooses in "Delivery Zip
Code".

The table called "Zip Codes" has the list of the zip codes a user can select
in the form and the matching cities.

How do I get the "Delivery City" to fill in automatically?
Thanks for your help.
 
D

Debra Farnham

Hi Bryan

Add the City field to the rowsource of your combobox and hide it if you want
(set the column widths to 1"; 0")

Your combobox rowsource should then consist of ZipCode and City with the
city being invisible to the user

On the On Change event of the combobox (in the VBA window) type the
following:

Me.nameocontroltoholdDeliveryCityName = me.nameofcombobox.column(1)

HTH

Debra
 
B

Bryan Bloom

Debra, it WORKED!

Thanks

Debra Farnham said:
Hi Bryan

Add the City field to the rowsource of your combobox and hide it if you want
(set the column widths to 1"; 0")

Your combobox rowsource should then consist of ZipCode and City with the
city being invisible to the user

On the On Change event of the combobox (in the VBA window) type the
following:

Me.nameocontroltoholdDeliveryCityName = me.nameofcombobox.column(1)

HTH

Debra
 

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

Top