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

How to work out the month prior to the last full month

Status
Not open for further replies.

Kelser

Instructor
May 14, 2005
29
IE
I am using Crystal 11. I have a date field and I need to look up the last month, which works fine using the LastFullMonth function. However, I also want to be able to see information for the month previous to that, whatever that month is. So, if I use this function today:
{Book.DateIn} = LastFullMonth
it pulls up the information for November. Now, I also want to see the information for October - as in LastFullMonth - 1. Can anyone help me? I'm not technical so will need a clear explanation!
Many thanks in advance.
 
Try using the DateSerial function.
It allows you to use offsets to the month specified.
For example:
Code:
{Book.DateIn} in DateSerial (Year(CurrentDate),Month(CurrentDate)-2,1) to DateSerial (Year(CurrentDate),Month(CurrentDate),1-1)
This code goes back 2 months from the 1st day of the Current month and ends at the last day of the last full month.

Bob Suruncle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top