Home
Crystal Reports Training
Crystal Reports XI
Crystal Reports .NET
Crystal Reports Forum
News
Tech Support
Active Topics
Memberlist
Search
Help
Register
Login
Report Design
Crystal Reports Forum
:
Crystal Reports 9 through 2022
:
Report Design
Topic: Current date as default in Date Parameter ??
Author
Message
jbalbo
Senior Member
Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Topic: Current date as default in Date Parameter ??
Posted: 14 Jun 2013 at 9:43am
Does anyone know how to do current date as a default parameter?
I tried :
this formula
DateVar StartDate;
If {?Thru Date} = Date('1/1/1900') then
(
StartDate := DateAdd('m', -1, CurrentDate);
StartDate := Date(Year(StartDate), Month(StartDate), 1);
)
else
StartDate := {?Thru Date};
StartDate
but getting a date is required error on the DateAdd ??
Any ideas would be great
Thanks
Joe
IP Logged
praveeng
Senior Member
Joined: 11 Jul 2011
Online Status: Offline
Posts: 165
Posted: 17 Jun 2013 at 4:31am
Hi,
DateAdd function returns DateTime value, but in your case you have defined StartDate as Date field.
Change the formula as below in 4 th line,
StartDate := Date(DateAdd('m', -1, CurrentDate));
P.S: Do you want to assign current date or First day of the current month, because using your formula it will assign first day of the current month.
Praveen Guntuka,
praveen_guntuka@yahoo.com
IP Logged
jbalbo
Senior Member
Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Posted: 17 Jun 2013 at 5:26am
Thanks
That formula works now..
But unlike SSRS why can't I put today's date in the default value in the parameter?
I use 1/1/1900 in the default which gives me today's data, but if someone what's to use yesterday, they have to manipulate the calender from 1900...
IP Logged
Printable version
Forum Jump
-- Select Forum --
Announcements
Talk with the Author
Self-Publishing
Job Postings
New feature request
Report Design
Data Connectivity
Technical Questions
Tips and Tricks
Crystal Xcelsius
Report Design
Data Connectivity
Writing Code
Tips and Tricks
Report Design
Data Connectivity
Writing Code
Tips and Tricks
You
cannot
post new topics in this forum
You
cannot
reply to topics in this forum
You
cannot
delete your posts in this forum
You
cannot
edit your posts in this forum
You
cannot
create polls in this forum
You
cannot
vote in polls in this forum
HOME
|
FREE EBOOK
|
PROGRAMMING GUIDE
|
PURCHASE
|
REVIEWS
|
CONTACT ME
|
FAQ
|
LINKS
|
PRIVACY
|
CLICK PLAYS
|
KONACAD
© 2004-2026 Brian Bischof. All Rights Reserved.