Simple Question

G

Guest

Hi,

I just had to fix a query my boss was writing. I guessed the answer
correctly, but I really don't know why it is so. There were two query items
with criteria. One had letters like ACR, BLP, etc. and the others were code
numbers.

The criteria were phrased like this: "ACR" Or "BLP" and "1" Or "2" Or "3".

All I did was remove the quotation marks from the numbers and the query
works fine. Can anyone tell me why? Shouldn't quotation marks be placed
around numbers?
 
R

Rick B

Quotation marks denote a text string. If the field is a numeric field, then
you want to see results that are equal to the NUMBER entered, not the TEXT
STRING entered.

You might get a more technical post as to why using the string does not work
as far as how the data is stored. I simply know that the number 4 is not
equal to the string "4".

Hope that helps a little.
 
J

John Spencer

If the field you are applying criteria is a number field then no quotes
should be used.
If the field is a text field that contains numeric characters then quotes
should be used.


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
G

Guest

Thank you both. That accounts for the error message about "type mismatch in
criteria expression". The numbers being queried were actually numbers and
not numbers saved as text.
 

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