Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return Everything prior to current month&year 1

Status
Not open for further replies.

Larft

Technical User
Dec 9, 2002
55
In my Access '03 DB I am trying to set up several Monthend query functions for laboratory project tracking, there are records that go back several years as well as recent ones that could have been added since the first day of the current month, and I would like to be able to run the monthend report any time within the "new" month. The function that's giving me grief is to return ALL records prior to the current month (not just the previous month and not necessarily from the same year), the field I am trying to apply the limiter to is a DATE field [Assigned_Lab_Date] and I have also included a yes/no field [Closed] that returns only the "Yes" result. I've tried several approaches including tho following with no sucess:

"=Month(Now())-1" this yields nothing
"Month(DateAdd("m",-1,Date()))" gives me results but not all of them.

Any help would be appreciated.
 
SELECT *
FROM YourTable
WHERE (([Assigned_Lab_Date] < Dateserial(Year(Date()), Month(Date()), 1)) AND ([Closed]=True))
 
JerryKlmns

Thanks for your help!
You get a star, the code did the trick, I'll add this one to my list for future reference.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top