Link to home
Start Free TrialLog in
Avatar of garyrobbins
garyrobbinsFlag for United States of America

asked on

How do I select last date of previous month?

How do I alter the below to select last day of previous month rather than current date?

0-365: Sum(((IIf([ORDER_DATE]>=Date()-365,[AMOUNT_BILLED],0))))
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

The last day of the previous month:
DateSerial(Year(Date()), Month(Date()),0)

mx
And this should come in handy:

Functions for calculating and for displaying Date/Time values in Access:

http://support.microsoft.com/kb/210604

mx
First day of current month can be found with DateSerial(Year(Date()), Month(Date()), 1)

Last day of previous month is DATEAD that -1

Kelvin
ASKER CERTIFIED SOLUTION
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of garyrobbins

ASKER

Thank you both, first for putting in the thread like that, Joe and the explanation HNASR.  Working Great.
Welcome!