Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Parameter to default to CurrentDate?

Status
Not open for further replies.

fredong

IS-IT--Management
Sep 19, 2001
332
US
I am using CR v 8.0 and with a datetime paremeter field on my with SQL 2000 store procedure. I need to automatic default to CurrentDate on the datetime parameter on the report each time I schedule to run. Is that possible? Thanks.
 
You could set an arbitrary value as your parameter default, as say Date(0,0,0), and make the description for the default "Current Date".

Alter the parameter to display description only, if necessary, and amend your record selection criteria to say
Code:
If {?Parameter} = Date(0,0,0)
Then CurrentDate
Naith
 
where do I put this information at? At the Record selection?
 
Put the code part in your Record Selection.

Everything before the code window is formatting you do in the parameter editor.

Naith
 
I placed in the record select and it return an error

"The result of selection must be a boolean." Please advise.Thanks.
 
Naith is speaking of detecting what is entered, to answer your question, the default value of the prompt IS the currentdate.

-k
 
so where should i put this to default to currentdate.Please advise.Thanks.
 
I think Naith is suggesting that in your record selection formula you have something like :
Code:
{mytable.myfield}=xyz
and (If {?Parameter} = Date(0,0,0)
Then {Mytable.MyDateField}=CurrentDate)

When editting your parameter you would set the value ("Set Default Value" button) to 00/00/0000. Your record selection formula will then check for this parameter value and if it has been left as 00/00/0000 by the user then the currentdate's data will be returned otherwise the data for the user-input date will be returned.

Hope this helps.
ShortyA

ShortyA
 
on the "Set Default Value" button it will not allow me to insert 00/00/0000. Each I try to type in 00 it will flip to a non zero value. Any ideas.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top