automatic field population

  • Thread starter Thread starter Lauren B
  • Start date Start date
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
 
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
 
Back
Top