Brogrim
asked on
Qury between 2 dates
I have a fiedl on a form, I wan to return all the records 21 days before that day
I gave tried <=Date() -21
and load others but can't get it working
Any ideas
I gave tried <=Date() -21
and load others but can't get it working
Any ideas
if FutureDate - getdate () <= 21 ...
ASKER
I don't understand
I want all the records starting at the form field date and 21 days before that
I want all the records starting at the form field date and 21 days before that
Assuming this is Access, then you will need something like this in the WHERE clause of your query:
WHERE DateInTheTable <= (CDate(Forms![NameOfForm]![NameOfDateField]) - 21)
ASKER
tried that with this SQL not working
SELECT tblddai_renewalpostdate.da terenewalp osted
FROM tblddai_renewalpostdate
WHERE (((tblddai_renewalpostdate .daterenew alposted)= ([Forms]![ frmDDAI_SB ]![txtStar tDate])-21 ));
SELECT tblddai_renewalpostdate.da
FROM tblddai_renewalpostdate
WHERE (((tblddai_renewalpostdate
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
You are most welcome! Note my comment was in support of Patrick's regarding CDate(). If that is what solved the issue, then please know you won't offend me any by requesting a Moderator change this to a split or credit to Patrick. If the DateAdd() is what did it, then glad that helped!
Best regards and happy coding,
Kevin
Best regards and happy coding,
Kevin