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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query limited by date range, automatically calculated on open

Status
Not open for further replies.

cdck

Programmer
Nov 25, 2003
281
US
I have a database that tracks calibration records for company equipment. When the database is opened, I need it to pull up a query that tells the user all the pieces of equipment that are due to have calibrations performed during the month in which it is opened.

The table is CalRec and the field the query needs to look at is NextDue.

I want this query to determine what month it is when opened and then compare records to that month and pull them based on that, so long as the year is the same, and ignoring the day.

I'm not sure how to make it pull the date in that field apart for querying...

Thank you,
Cheryl

Cheryl dc Kern
 
I apologize - while awaiting a response, I finally found the answer to my question in a mix of two other threads.

This is the query that I wrote, which works very well, should anyone else encounter an issue with manipulating dates:

SELECT *
FROM CalRec
WHERE (((Month([CalRec].[NextDue]))=Month(Date())) AND ((Year([CalRec].[NextDue]))=Year(Date())));

Thank you, anywon who viewed this, for taking the time.

Cheryl

Cheryl dc Kern
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top