Solved

DateAdd function

Posted on 2004-04-19
4
1,418 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
ID: 10860807
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
ID: 10861351
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
ID: 10862201
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
ID: 10862751
You need "" around the M and it can only be a single m like:

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

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

920 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

18 Experts available now in Live!

Get 1:1 Help Now