Weird query giving unexpected results.

J

Julian

Hi, this is my first posting to this group as I have a very strange
problem in Access 2002. I have a query which combines 2 linked tables
with a one to one join. This query works fine, now when I write a
further query which includes the first query and has two fields with
equal to criteria i.e. dateTo = #3/1/2001# and SiteType="P" I get no
records showing up, yet when I set the criteria to dateTo=#3/1/2001# and
leave off the Sitetype criteria, I get a bunch of records returned which
have a SiteType of "P" !!!!!
When I use a filter by form with the same criteria, the filter returns
the records !! How can I get this query to work correctly?

this query will return records with a siteType of P( as that is what is
in the table for that date.)
SELECT RevQRes.* FROM RevQRes WHERE ((RevQRes.To)=#4/1/2002#);

However this query returns no records !!
SELECT RevQRes.* FROM RevQRes WHERE (((RevQRes.To)=#4/1/2002#) AND
((RevQRes.SiteT)="P"));

RevQRes is a query based on 2 linked access tables(backend)

Please does anyone know of this being a problem in access?
 
A

Arvi Laanemets

Hi

Try
SELECT RevQRes.* FROM RevQRes WHERE (((RevQRes.To)=#4/1/2002#) AND
(TRIM((RevQRes.SiteT))="P"));
 
J

Julian Cropley

Hi

Try
SELECT RevQRes.* FROM RevQRes WHERE (((RevQRes.To)=#4/1/2002#) AND
(TRIM((RevQRes.SiteT))="P"));

No that is not the problem the "P" is just a "P" there is no leading
or trailing spaces!
 
A

Arvi Laanemets

Hi

What do you get with query
SELECT RevQRes.* FROM RevQRes WHERE RevQRes.SiteT="P";
Does it work as exepted?
 

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