Hi
I am having a wonderful date problem when trying to limit records in a query.
I am trying to return all the records with a date (entered by the user) earlier than the calculated field, TargetDate
TargetDate: DateAdd("m",2,[Request rec'd])
The expression works if I hardcode the date into the criteria but I need to be able to make it dynamic - allowing the user to enter the date of their choice.
Criteria:
<=#09/01/2004# (this works and displays the correct records)
<="#" & [Enter Date] & "#" (returns no records - the data is there)
<=[Enter Date] (returns incorrect records, each differing with different dates entered - cannot find a pattern)
SQL of entire query:
SELECT tblRequestMain.[Allocation No], tblRequestMain.[Court Ref], tblRequestMain.[Family Name], tblProceedingType.Proceedings, tblRequestMain.[Request rec'd], DateAdd("m",2,[Request rec'd]) AS TargetDate, tblRequestMain.[Initial Court], tblRequest.[Date appointed]
FROM (tblRequest RIGHT JOIN tblRequestMain ON tblRequest.[Allocation No] = tblRequestMain.[Allocation No]) INNER JOIN tblProceedingType ON tblRequestMain.Proceedings = tblProceedingType.Code
WHERE (((DateAdd("m",2,[Request rec'd]))<=#1/1/2004#) AND ((tblRequest.[Date appointed]) Is Null));
I'd appreciate any help I can get.
Thanks,
Sel
I am having a wonderful date problem when trying to limit records in a query.
I am trying to return all the records with a date (entered by the user) earlier than the calculated field, TargetDate
TargetDate: DateAdd("m",2,[Request rec'd])
The expression works if I hardcode the date into the criteria but I need to be able to make it dynamic - allowing the user to enter the date of their choice.
Criteria:
<=#09/01/2004# (this works and displays the correct records)
<="#" & [Enter Date] & "#" (returns no records - the data is there)
<=[Enter Date] (returns incorrect records, each differing with different dates entered - cannot find a pattern)
SQL of entire query:
SELECT tblRequestMain.[Allocation No], tblRequestMain.[Court Ref], tblRequestMain.[Family Name], tblProceedingType.Proceedings, tblRequestMain.[Request rec'd], DateAdd("m",2,[Request rec'd]) AS TargetDate, tblRequestMain.[Initial Court], tblRequest.[Date appointed]
FROM (tblRequest RIGHT JOIN tblRequestMain ON tblRequest.[Allocation No] = tblRequestMain.[Allocation No]) INNER JOIN tblProceedingType ON tblRequestMain.Proceedings = tblProceedingType.Code
WHERE (((DateAdd("m",2,[Request rec'd]))<=#1/1/2004#) AND ((tblRequest.[Date appointed]) Is Null));
I'd appreciate any help I can get.
Thanks,
Sel