How to write correct code (syntax)
Application Type
Traditional Web
NewDate( Year(CurrDate), Month(CurrDate), 1), AddMonths(NewDate(Year(CurrDate()),Month(CurrDate()),1),-1)

How to correct write (i have syntax error)


Can you explain what you want with this function?

Best regards,


I wish that I could take any date and download the last month's report

Because you have a comma, right after the first NewDate () function, which shouldn't exist.

The result of the code you have now, is 2 dates, separated by a space. This is not valid.

If the result you need is the first day of the previous month, then just remove everything before "AddMonths".

Maybe this:

AddMonth(InputDate,-1)<=DateReport and 

DateReport <=InputDate

Or you should separate this funciton into two assigns. 

Begin date: 

NewDate( Year(CurrDate), Month(CurrDate), 1)

End date:


Hi kan,

  Substr(AddMonths(#2020-11-1#,1),9,9) = 1
Put this condition in "IF".
Hope this Helps.



Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.