Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Database Design / April 2005

Tip: Looking for answers? Try searching our database.

Combo box - wrong values

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Larry - 15 Apr 2005 18:16 GMT
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
George Nicholson - 18 Apr 2005 18:50 GMT
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,
Signature

George Nicholson

Remove 'Junk' from return address.

> 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
[quoted text clipped - 34 lines]
>
> Thanks Larry
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.