Simple query not working

G

G.

This should be simple. My query is based on a table with text data types. The
field I am querying has 1 letter in it as the record entry. It can have "I"
or "N", etc. When I create a query to search for all records for a specific
letter there are 0 results returned. The SQL statement is

SELECT [CSEC4-09].[PT Type]
FROM [CSEC4-09]
WHERE ((([CSEC4-09].[PT Type])="N"));

Does anyone have any insight into why this may be happening? The other
fields seem to be fine when I use criteria within them. Thank you.
 
K

kc-mass

For the sake of diagnostics try trimming the content of PT Type as in :
SELECT [CSEC4-09].[PT Type]
FROM [CSEC4-09]
WHERE (((TRIM([CSEC4-09].[PT Type]))="N"));

If that works your data has spaces embedded in it.
You could also test for the LEN(PT Type) <> 1
 
R

Ron2006

The first place I would look is to see if there are any leading or
trailing spaces in the field.

Try using the Like "*N*"

Or change the query to have no criteria and have it display the length
of the "PT Type" field.

Ron
 

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