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

Last Day of Last Month formula error

Status
Not open for further replies.
Jul 9, 2007
12
CA
I'm trying to write a couple of formulas that determinethe first day of last month and the last day of last month.

Currently I'm trying to use the following formulas:

MinDate: DateSerial(Year(currentdate),Month(currentdate)-1,1)
MaxDate: DateSerial(Year(currentdate),Month(currentdate),1 – 1)

It seems pretty obvious to me, but for MaxDate I'm getting the error "The ) is missing".

I'm using Crystal XI.

Anyone know where I'm going wrong? Also, I'm assuming this also works for leap years, but can anyone confirm it?

Thanks!
 
Your max formula should be:

DateSerial(Year(currentdate),Month(currentdate),1)–1

-LB
 
Interestingly enough, I tried the formula in another report and didn't get the error. So I copied and pasted the formula from the working report into my broken report.

Lo and behold, it worked. I have no idea why it didn't work considering I eyeballed the two formulas and they look exactly the same.

That's the kind of stuff that'll drive a man crazy.
 
lbass,

Yours works too, although I should say I tried that before and was getting the error that the remaining text didn't seem to be part of the formula.

I'm going to chalk it up to wierd crystal or computer behavior.

I appreciate the quick response though.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top