Populating text boxes bepending on a Combo box

  • Thread starter Thread starter Indyexe
  • Start date Start date
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.
 
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.
 
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
 
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
 
Back
Top