automatic field population

L

Lauren B

I am attempting to have a combo box of zip codes, that when selected will
automatically population the corresponding state and county fields. To
accomplish this task, I have created a query. The query contains the
fields: Zip Code, State, and County. This query is set as the row source
for the zip code field, and I have the following after update code:

Private Sub ZIPCODE_AfterUpdate()
STATE = Me.ZIPCODE.Column(1)
COUNTY = Me.ZIPCODE.Column(2)
End Sub

This code works to populate the state field, but will not work for the
county field. Also, this only works on existing entries, not newly created
ones. How can I correct these problems?

Thank you in advance for any assistance.

LB
 
N

Nikos Yannacopoulos

Lauren,

You references to the controls on the form are not correct. Try:

Private Sub ZIPCODE_AfterUpdate()
Me.STATE = Me.ZIPCODE.Column(1)
Me.COUNTY = Me.ZIPCODE.Column(2)
End Sub

and make sure the control names are correct!

HTH,
Nikos
 

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