DateAdd function

When I created a formula using DateAdd(MM, -1, ?@StartDate) I got a message: the ) is missing. why is this? I didn't see any problem with it. Thanks a lot!
Who is Participating?

Improve company productivity with a Business Account.Sign Up

stasauConnect With a Mentor Commented:
You need "" around the M and it can only be a single m like:

DateAdd("m", -1, {?@StartDate})

Hello qinyan,

Are you trying to subtract one month from the date?
DateAdd ("m", -1, mydatefield)

I don't know what you mean by  ?@StartDate
In CR parameter fields begin with ? and formula fields begin with @.

Put the correct name into the formula instead of mydatefield.

I believe the formulas or parameters also  need to be put in {  }

DateAdd(MM, -1, {@StartDate}) or

DateAdd(MM, -1, {?StartDate})

qinyanAuthor Commented:
Yes, I'm trying to substract one month from the date.
@StartDate is a parameter from stored procedure and that's why it has a @ sign and user needs to enter a date for @StartDate. When you use this as a parameter in CR the '?' is added before it. I just drag and drop this field into the formula.
Sorry, Yes it's put in { } like DateAdd(MM, -1, {?@StartDate})

I used this parameter in other formula and it works. eg.
cstr(Month({?@StartDate}), 0) + " / " + cstr(Day({?@StartDate}), 0)
and the result is 2/16 if the user enter Feb 16 as the StartDate.
and what I'm trying to do is to return the date one month before the user entered date.

Thanks everybody!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.