Combo box - wrong values

L

Larry

I've got a combo box on a form that has two columns, "Country" and
"Province". The combo box data source is a query that references both fields
in ascending order. The combo box properties are as follows:

Control source type: [Province Name] (field in record source of form)

Row Source Type: Table/Query

Control source: SELECT [Countries and Provinces].[Country Name], [Countries
and Provinces].[Province Name] FROM [Countries and Provinces] ORDER BY
[Country Name], [Province Name];

Bound Column: 2
Limit to list: Yes
Column count: 2
Column Heads: Yes
Colums widths: 1";1"

PROBLEM:

Combo box drops down, user sees both columns and selects the
country/province that is appropriate. Since the bound colum is set for 2, I
should see the province value in the "Province Name" field. Doesn't happen.

When the form is launched, the records show the correct provinces, when I
try to change the field value via the combo box or add a new record, I get
the country value instead of the province. If I change the column count to 1,
I get the same thing.

Can't figure out whats going wrong. Why isn't the table field getting the
proper combo box value?


Thanks Larry
 
G

George Nicholson

BoundColumn doesn't control what displays in the combo, it controls what
gets stored in the underlying field. Bound Column is 1 based, so your
setting of 2 should store Province.

The left-most visible field is what will display. This is controled by your
query and ColumnWidths. Since Country is the first visible field, that is
what is displaying.
If I change the column count to 1, I get the same thing.
Per Help: "The Bound column can't be set to a value larger than the setting
of the ColumnCount property."

2 possible solutions:
1) Switch the order of Country and Province in your SELECT:
SELECT [Province Name], [Country Name], etc..(leave the ORDER BY as is)
Change BoundColumn to 1

2) Consider something like this:
SELECT [Country Name], [Province Name], [Country Name] & " " & [Province
Name] AS CountryProvince, FROM [Countries and Provinces] ORDER BY
[Country Name], [Province Name];
ColumnCount: 3
BoundColumn: 2
ColumnWidths: 0;0;1
You display the Country & Province combination, but you only store Province.

HTH,
--
George Nicholson

Remove 'Junk' from return address.


Larry said:
I've got a combo box on a form that has two columns, "Country" and
"Province". The combo box data source is a query that references both
fields
in ascending order. The combo box properties are as follows:

Control source type: [Province Name] (field in record source of form)

Row Source Type: Table/Query

Control source: SELECT [Countries and Provinces].[Country Name],
[Countries
and Provinces].[Province Name] FROM [Countries and Provinces] ORDER BY
[Country Name], [Province Name];

Bound Column: 2
Limit to list: Yes
Column count: 2
Column Heads: Yes
Colums widths: 1";1"

PROBLEM:

Combo box drops down, user sees both columns and selects the
country/province that is appropriate. Since the bound colum is set for 2,
I
should see the province value in the "Province Name" field. Doesn't
happen.

When the form is launched, the records show the correct provinces, when I
try to change the field value via the combo box or add a new record, I get
the country value instead of the province. If I change the column count to
1,
I get the same thing.

Can't figure out whats going wrong. Why isn't the table field getting the
proper combo box value?


Thanks Larry
 

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