Setting criteria to get reslts

L

lilczech

I created a tale for product specifications. The product names are formatted
ABC-123. They are selected using a combo box from another table.I am running
a simple query but cannot get it to run on my table. For the criteria, I
have [enter product name]. When the box comes up and I enter a product, the
query comes up blank. If I do not set the criteria, everything comes up
fine. I ran the same criteria on the table of product names where my tables
selects from and it works. I'm confused as to why I can't select in my
specifications table!!
 
J

John W. Vinson

I created a tale for product specifications. The product names are formatted
ABC-123. They are selected using a combo box from another table.I am running
a simple query but cannot get it to run on my table. For the criteria, I
have [enter product name]. When the box comes up and I enter a product, the
query comes up blank. If I do not set the criteria, everything comes up
fine. I ran the same criteria on the table of product names where my tables
selects from and it works. I'm confused as to why I can't select in my
specifications table!!

I'm guessing that you're yet another victim of the Lookup Field misfeature: is
the product name field a Lookup Field in this table? If so what you SEE is
ABC-123, but what is actually STORED in the table (and therefore available to
the query criteria) is a meaningless number.

Try using a combo box as a criterion also (independent of the lookup field
issue): you can use a form (frmCrit let's call it) with an unbound Combo Box
(cboProduct), and a criterion

=[Forms]![frmCrit]![cboProduct]

This will let the user select an existing product rather than needing to type
one in, and risk errors if they make a minor typo.
 
J

John Spencer

Does your table that you are selecting from have another column that is
the primary key and is an autonumber field?

If so, the problem is probably that what you see is the descriptive text
name of the product, but what is actually stored is the ID number of the
row (the primary key).

If that is the case you should be able to enter a valid number to get a
record returned.

How you fix this depends on a number of factors. So test this and if
entering a valid product number works, post back.

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 

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