How to fix Where condition?? (1 Viewer)

danbl

Registered User.
Local time
Today, 01:01
Joined
Mar 27, 2006
Messages
262
:)I have used the duplicate finder query wizzard to generate the query below.

=============================================
SELECT qryAD.VisitDate, qryAD.DOB, qryAD.aid, qryAD.vil
FROM qryAD
WHERE (((qryAD.VisitDate) In (SELECT [VisitDate] FROM [qryAD] As Tmp GROUP BY [VisitDate],[DOB] HAVING Count(*)>1 And [DOB] = [qryAD].[DOB])))
ORDER BY qryAD.VisitDate, qryAD.DOB;
==============================================
I now want to add date perameters from a form so I can see only certain periods of time. I use the following syntax
Between [Forms]![Date Range Form]![Start Date] And [Forms]![Date Range Form]![End Date] to select the date range.

Can someone please show me how to add the date range above to this query? I have no real knowledge of SQL but looking to learn.
 

Brianwarnock

Retired
Local time
Today, 04:31
Joined
Jun 2, 2003
Messages
12,701
I would put it in a Where clause in the sub query as you should filter out unwanted records as soon as possible.



=============================================
SELECT qryAD.VisitDate, qryAD.DOB, qryAD.aid, qryAD.vil
FROM qryAD
WHERE (((qryAD.VisitDate) In (SELECT [VisitDate] FROM [qryAD] As Tmp Where visitdate Between ...etc GROUP BY [VisitDate],[DOB] HAVING Count(*)>1 And [DOB] = [qryAD].[DOB])))
ORDER BY qryAD.VisitDate, qryAD.DOB;
==============================================


Brian
 

danbl

Registered User.
Local time
Today, 01:01
Joined
Mar 27, 2006
Messages
262
Thanks Brian ... I will give this a try and see what I get.

Dan
 

danbl

Registered User.
Local time
Today, 01:01
Joined
Mar 27, 2006
Messages
262
Brian .... this appears to be working correctly now. Thank you very much for the help!!!

Dan
 

Users who are viewing this thread

Top Bottom