Auto-Completing Two Fields Based on Value in Another Field

M

Martin

I have three fields in my Table called "Crime":

Location
Eastings
Northings

I want to create a form where the user looks up an address in a
combo-box for the field "Location". The Table containing these values
is called "Gazetteer", and the field is called "Location". Having
chosen an Address from the list, I would like the other two fields,
Eastings and Northings to be automatically populated with corresponding
values from the Table "Gazetteer".

The Gazetteer Table is structured as follows:

Location Eastings Northings
12 High Street London 273810 538273
15 High Street London 273819 538272
21 Bridge Street London 249765 532918

Basically, how can I auto-fill the eastings and northings fields based
on the selection from the Location field?

Your help and advice much appreciated and my brain is frying.

Martin
 
A

Al Camp

Martin,
Add Eastings and Northings columns to your combo box.
Use the AfterUpdate event of the combo to update the Eastings and
Northings fields on your form...
Me.Eastings = cboLocation.Column(1)
Me.Northings = cboLocation.Column(2)
(combo columns are numbered 0,1, 2, 3, etc, so the second column is (1))
hth
Al Camp
 

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