16th of Last Month to 15th of This Month...

A

ABAX

Hey all ....

I have a query where I would like remove the parameter prompt and
automatically obtain records between the 16th of last month and the 15th of
this month. Can't figure out if it's DateAdd, DateSerial, etc. Any help
would be greatly appreciated. Thanks in advance.

- ABAX
 
J

Jeff L

Try
Between DatePart("m",Date())-1 & "/16/" & DatePart("yyyy",Date()) And
DatePart("m",Date()) & "/15/" & DatePart("yyyy",Date())
 
J

John Spencer

I would use dateSerial function.

Where SomeDateField >= DateSerial(Year(Date()),Month(Date())-1,16) and
SomeField < DateSerial(Year(Date()), Month(Date()),16)

IF your datefield doesn't contain a time, then you could use
Between DateSerial(Year(Date()),Month(Date())-1,16) and
DateSerial(Year(Date()), Month(Date()),15)
 
A

Allen Browne

To treat the first 15 days of a month as if they belonged to the previous
month, type this expression in the Field row in query design:
DateAdd("d", -15, [YourDateField])

You can then group on this calculated field in your report, or query, or
whatever.
 
Top