View Full Version : Combo Box in Table returns numerical value in Query


veraloopy
06-04-2009, 03:18 AM
i'm pulling my hair out with this one....

I'm using combo boxes on a form that link to another table to return a list of items.

One in particular 'Status' works fine on all the forms and on the tables but when I run a query to search on a value from the list, it shows no results but if I seach on the ID number of the item, it brings back the results.

How do I enter a value of the list in the criteria instead of having to use the numerical id of the item.

i.e.

ID Value
1 New
2 Shipped
3 Invoiced

When running the query against the Status, I set the criteria in the query to Like [Enter Status] & "*" but when I run this and type 'Shipped' as the criteria I get no results, however, If I enter the criteria as '2' I then get the correct results.

I have checked the bound to column and the column count (bound to is set to 1 and column count is set to 2).

Any ideas?

Any help is much appreciated :):):)

rainman89
06-04-2009, 03:31 AM
In the query do you have the "enter status" in the ID field or the value field? If its in ID then that is why you are having the problems you are having

veraloopy
06-04-2009, 04:01 AM
In the query I haven't added in the 'Status' table as the main table links to it already
When I do, it is linked to the StatusID field and if I change it to the value, I get a type mismatch error.

However, bearing in mind that the value side of it works everywhere else in the database, just not in queries...

I'm having the same problem with other similar fields

rainman89
06-04-2009, 04:07 AM
That is the reason then.

What it is doing is looking for a numerical representation of status, which you are not providing.

If it is a combo box, you should be able to select the status and have it do what you want.

Just check your bound column and make sure it is not supposed to be 0. Which I believe it is for a combo box

namliam
06-04-2009, 04:08 AM
The trap of lookup columns...

You need to add your Status table to the query, your "lookup column" basicaly only contains the ID for the lookup, not the Text that it is displaying.
If you want to search on the text you have to add the Status table and search on the text there, then join that back into your table.

veraloopy
06-04-2009, 04:09 AM
Is this the bound column on the query properties?

Thanks :)

namliam
06-04-2009, 04:10 AM
The bound column of the COMBOBOX properties... yes...

Query properties has no such property

rainman89
06-04-2009, 04:18 AM
Either way will work. If you go Mailman's way you will need to modify the query.

My way should just need to modify the combobox on the form.

Either way should work

veraloopy
06-04-2009, 04:20 AM
aha!!!

Just figured it out, I was adding the status table into the query but setting the criteria against the status field in the main table and not from the status table

Quite easy when you know how! lol

Many thanks for all your help guys/gals :) :) :)

rainman89
06-04-2009, 04:42 AM
Mailman's a gal??? :confused: :confused: :D :eek:

namliam
06-04-2009, 06:07 AM
I am just posing as a mailman, I am not actualy one :)

rainman89
06-04-2009, 06:09 AM
I am just posing as a mailman, I am not actualy one :)

Haha.. Nice@!