Search Criteria for combo boxes

G

Guest

Hi. This should be really easy but I must have a block or something. I have
created a Search Form with a number of unbound boxes some of which are combo
boxes. In these cases the Row Source is (ie. SELECT DISTINCT
Tbl_MAIN.Province FROM Qry_Search).

While my query and table actually displays the province, on the Search Form
when you click on the drop down, the options are 1,2,3.... which is of course
the Province ID from Tbl_Province.

How can I make the search fields show the appropriate text options? Thanks!
 
M

Mr. B

Hi. This should be really easy but I must have a block or something. I have
created a Search Form with a number of unbound boxes some of which are combo
boxes. In these cases the Row Source is (ie. SELECT DISTINCT
Tbl_MAIN.Province FROM Qry_Search).

While my query and table actually displays the province, on the Search Form
when you click on the drop down, the options are 1,2,3.... which is of course
the Province ID from Tbl_Province.

How can I make the search fields show the appropriate text options? Thanks!

Carrie,

Try changing the Column Count property of your combo boxes. The
default is 1. If your record source is (and it sounds as if it is)
returning more that one field (which is not uncommon) then you have to
tell the combo box how many columns your are expecting. Then modify
the Column Widths property. You would provide a width for each column
that your record source is returning. If there are columns being
returned that you do not want to be displayed, just make that column
width be zero.

If, in your case, your record source is returning two colums (then ID
field and a Province name) then you would want only the Province Name
to appear in the combo box. So, you would set the column widths
property to zero for the first column and the second column width to a
width equal to the entire width or your combo box.

Hope this helps.

Mr. B
 
G

Guest

Of course this should work and I can't believe I didn't think of that myself!
Anyways, for some reason it isn't! I have put in 2 columns but only the ID
is showing - the other column is blank. Have I maybe done something wrong
with my table design? The Province name does show up in my table and query.
It also shows up in my Main Form.

Thanks!
 
G

Guest

Figured this out for myself - had to change the query to look up the Province
from Tbl_Province instead of from Tbl_MAIN. As always, thanks for the help.
 
M

Mr. B

Of course this should work and I can't believe I didn't think of that myself!
Anyways, for some reason it isn't! I have put in 2 columns but only the ID
is showing - the other column is blank. Have I maybe done something wrong
with my table design? The Province name does show up in my table and query.
It also shows up in my Main Form.

Thanks!








- Show quoted text -

Carrie,

Sounds like your query that is retuning the recordset for your combo
box has the Name as the first field that is being returned.

Try changing the Column Widths to: Some Widht and then zero for the
second columm. If the Name value rather than the ID number is being
saved to your table then this is the case as the bound column is
defaulted to always be the first column in your record source.

Hope this helps.

Mr. B
 

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