Bound combobox

J

j_gold

Hi,

I have a bound combobox that I'm having an issue with. The form's
recordsource is tied to an associative table that contains a storeID as well
as other info.

What I would like to have displayed is the name of the store in the
combobox. I am able to do this, but the wrong store name is coming up. It
appears to off by one.

e.g. Stores table

storeID storeName
1 Brentwood
2 Nancy's flowers
3 Tom's hardware

So if I have a person whose storeID is 2, what I should see in the combobox
is Nancy's flowers, but I see Tom's hardware instead.

The combobox is set up as follows:

Control Source: storeID
Row Source: SELECT storeID, storeName FROM Stores;
Row Source Type: Table/Query
Bound Column: 0
Column Count 2
Column Widths: 0";0.5"

How do I fix this?

Thanks,

J
 
D

Dirk Goldgar

j_gold said:
Hi,

I have a bound combobox that I'm having an issue with. The form's
recordsource is tied to an associative table that contains a storeID as
well
as other info.

What I would like to have displayed is the name of the store in the
combobox. I am able to do this, but the wrong store name is coming up. It
appears to off by one.

e.g. Stores table

storeID storeName
1 Brentwood
2 Nancy's flowers
3 Tom's hardware

So if I have a person whose storeID is 2, what I should see in the
combobox
is Nancy's flowers, but I see Tom's hardware instead.

The combobox is set up as follows:

Control Source: storeID
Row Source: SELECT storeID, storeName FROM Stores;
Row Source Type: Table/Query
Bound Column: 0
Column Count 2
Column Widths: 0";0.5"

How do I fix this?


Check the ControlSource of the combo box to make sure it's bound to the
right field. Check the form's recordsource to make sure that the data in
that field is what you think it is.

If what you posted is only dummy data, verify that no two records in the
Stores table can have the same storeID. Obviously, that can't happen if
storeID is the primary key of the Stores table.
 
D

David H

Try going with a value of '1' for the bound column instead of '0'. This is
one of those scenarios where the value is 1 based as opposed to zero based.
 
J

j_gold

Hi Dirk,

Thanks for the tips. Yes, the storeID is a primary key. As per your's and
David's post it was a bound column issue.

Cheers,

J
 
D

Dirk Goldgar

David H said:
Try going with a value of '1' for the bound column instead of '0'. This is
one of those scenarios where the value is 1 based as opposed to zero
based.

Good spot! I didn't notice that the Bound Column property was set to 0. On
the property sheet the values are 1-based, while in VBA code they are
0-based.
 

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

Similar Threads


Top