How do I make a text box value appear based on a combo box selecti

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm kind of new to this so please forgive, if I'm asking a somewhat basic
question. I have a supplier database that I'm trying to setup. I thought it
would be really keen to set it up so that when you entered the country it
would automatically list the international calling code in a text box next to
it for reference. Had no idea how difficult it would be!

What I thought I should do is create second table and corresponding form for
adding a country which stores the name of the country and its corresponding
calling code. Then I would use a combo box on my Add Supplier Form which
users would use to select the country, and once selected would cause the text
box for the dialing code to be automatically filled in by the corresponding
calling code of that country.

Any suggestions for how I would go about this? Its a fairly basic thing, I
think...

Cheers,

Craig
United Kingdom
 
Let's assume that the recordsource populating your combobox has two fields
in it: CountryCd and DialingCd, in that order.

In the combobox's AfterUpdate event, put code to populate the DialingCd text
box:

Me.txtDialingCd = Me.cboCountry.Column(1)

The Column collection starts at 0, which is why you use Column(1) to refer
to the second column.
 
Back
Top