Expression doesn't affect value in combo

  • Thread starter Thread starter CW
  • Start date Start date
C

CW

I have a combo in which to select "DestCountry". There are about 20 of these.
Then there's another control that shows the "Price Band". That's also a combo
with 5 different values to choose from (1-5).

I wanted to code the AfterUpdate event on the DestCountry control, so that
the Price Band would be populated automatically.

As a first attempt, I used this:

If DestCountry = "Australia" Then
PriceBand = 5
End If

It doesn't work. I then tried having an ordinary text box for PriceBand
i.e. not a combo, and it worked fine. Is there something different I need to
do to get it to work on a combo, or is just not possible?
Many thanks
CW
 
The crucial issue here will be building a good relational structure.

Presumably any country has only one price band? And when you send to a
country, you want to know what price band to use.

You will need a table of valid price bands. This PriceBand table will have
one numeric field as primary key:
PriceBandID Number primary key

You will need a table of countries. If you use the country name as primary
key, it will have fields like this:
CountryID Text primary key
PriceBandID Number relates to PriceBand.PriceBandID

How you can create a combo with RowSource:
SELECT CountryID, PriceBandID
FROM Countries
ORDER BY CountryID;
The 2nd column of the combo will now contain the priceband for the country.

We don't know what your current table is for. If it does have 20 *fields*
where you can select up to 20 different countries in one record, that would
not be a relational design.
 
Back
Top