Parameter Query Problem

D

David McLean

Hi There

I've got a problem with a parameter query that I'm trying to run. I'd like
to pull out records based on a date value that is calculated (7 days before
the date store in tblReports). In the criteria section of my query under the
calculated date field, I've got "Between [From what date (dd-mmm-yy):] And
[To what date (dd-mmm-yy):]" without the quote marks.

Whats happening is that I'm getting results that are outside of the
parameters. For example, when i try to query records that are between 12 Jun
09 and 20 Jun 09, I'm getting a few records from Jul 09 in my results.

here is my SQL view if that helps:

SELECT DISTINCT tblCentres.CentreLocation, tblClients.CaseNumber,
tblClients.FirstName, tblClients.LastName, [DueToCM]-7 AS Expr1
FROM (tblCentres INNER JOIN tblClients ON tblCentres.CentreID =
tblClients.CenterID) INNER JOIN tblReports ON tblClients.ClientID =
tblReports.ClientID
WHERE ((([DueToCM]-7) Between [From what date (dd-mmm-yy):] And [To what
date (dd-mmm-yy):]))
ORDER BY [DueToCM]-7;

If anyone has any ideas, or would like to know more information, please let
me know. I'd appreciate any help I can get.

David
 
K

KARL DEWEY

Try this --
WHERE ((([DueToCM]-7) Between CVDate([From what date (dd-mmm-yy):]) And
CVDate([To what date (dd-mmm-yy):])))
 

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