Populating text boxes bepending on a Combo box

I

Indyexe

I am trying to populate 4 other separate text boxes of an address (road,
town, county & postcode) depending on the place chosen from a combo box drop
down list. I also want the form to save this information in a table separate
from the address table so I can revisit the record later even if the place
address has changed.

I think I need a macro but can not get this right.

Any help would be gratefully received.
 
A

Arvin Meyer MVP

You need a bit of VBA code in the combo's AfterUpdate event. You can read
other columns and "push" the data into the bound textboxes by using the
column property of the combo like:

Sub cboAddress_AfterUpdate()
Me.txtTown = Me.cboAddress.Column(3)
Me.txtCounty = = Me.cboAddress.Column(4)
' etc.
End Sub

Column(3) is actually the 4th column of the combo, and so on.
 
I

Indyexe

Thanks Arvin for your reply.

I will try this out and let you know how I get on being new to VBA coding.

Many thanks
 
I

Indyexe

Arvin

Just to let you know that it worked and was exactly what I wanted to do.

Many thanks again and I will now start to learn coding.

Thanks
 

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