?
Solved

DateAdd function

Posted on 2004-04-19
4
Medium Priority
?
1,425 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 101

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 500 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

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 …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

770 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