Solved

DateAdd function

Posted on 2004-04-19
4
1,420 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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. …
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 …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

839 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