Date Between Query

  • Thread starter Thread starter Tic3
  • Start date Start date
T

Tic3

How can I write a query that will retrieve all records from my database
with a date between the 19th of the current month and the 20th of the
previous month?

Thanks for any help!

Tic3
 
dt1 = date
dt2 = datediff("M",-1,dt1+1)
use these two dates in your query.
 
Assuming you're building the query using the query builder GUI, in the
Criteria cell under your date field, type the following:

BETWEEN DateSerial(Year(Date), Month(Date) - 1, 20) AND
DateSerial(Year(Date), Month(Date), 19)

(Don't worry: the DateSerial function will handle it correctly in January,
when Month - 1 = 0)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top