Solved

DateAdd function

Posted on 2004-04-19
4
1,417 Views
Last Modified: 2011-09-20
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!
0
Comment
Question by:qinyan
4 Comments
 
LVL 77

Expert Comment

by:peter57r
Comment Utility
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.


Pete
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
I believe the formulas or parameters also  need to be put in {  }

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

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

mlmcc
0
 

Author Comment

by:qinyan
Comment Utility
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!
0
 
LVL 4

Accepted Solution

by:
stasau earned 125 total points
Comment Utility
You need "" around the M and it can only be a single m like:

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

0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now