Date Query - Subtracting Months

crhodus

Registered User.
Local time
Today, 11:53
Joined
Mar 16, 2001
Messages
257
Hello Everyone,

I have a query where I am trying to pull records where the user took a class that is 2.5 years old or newer based on their license expiration date.

Can someone tell me what I'm missing/doing wrong?

SELECT tblCE_Details.LIC_NUMBER, tblCE_Details.Course_Code, tblCE_Details.Course_Date, sociwork1.expirat_dt
FROM Sociwork1 INNER JOIN tblCE_Details ON Sociwork1.LIC_NUMBER = tblCE_Details.LIC_NUMBER
WHERE (tblCE_Details.LIC_NUMBER = Forms![SW form]!SLIC_NUMBER)
AND tblCE_Details.Course_Date >= (sociwork1.expirat_dt - Month(30))
ORDER BY tblCE_Details.Course_Date;

Thanks,
Crhodus
 
(sociwork1.expirat_dt - Month(30))
use Dateadd
Dateadd("m",-30,sociwork1.expirat_dt)

Brian
 
That did it! Thanks for your help.

Crhodus
 
My pleasure, -Month(30) seemed to subtract 1 day making Month(30) =1, I would have expected it to just give an error. :confused:

Brian
 

Users who are viewing this thread

Back
Top Bottom