query criteria between dates

D

daniel

in query criteria.
this would show the last 2 weeks. if I look at it on the 15th day, it will
show the correct data.

Between Date()-Weekday(Date(),0)+1 And Date()-Weekday(Date(),0)-13

but if I look at the days on the, say, 10th day, the days would not be
correct anymore.
what formula/code could I use for first of the month to the 15th and from
the 15th to the last day of the month?
 
A

Allen Browne

First 15 days of the month:
= DateSerial(Year(Date()), Month(Date()), 1)
And < DateSerial(Year(Date()), Month(Date()), 16)

16th to end of month:
= DateSerial(Year(Date()), Month(Date()), 16)
And < DateSerial(Year(Date()), Month(Date()+1), 1)

The expressions cope if the field contains time values as well as dates.
 
D

daniel

thank you, Mr. Browne
it works perfect.

Allen Browne said:
First 15 days of the month:
And < DateSerial(Year(Date()), Month(Date()), 16)

16th to end of month:
And < DateSerial(Year(Date()), Month(Date()+1), 1)

The expressions cope if the field contains time values as well as dates.
 

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


Top