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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DateTime Field to just Date then use as parameter 5

Status
Not open for further replies.

smatthews

IS-IT--Management
Jul 27, 2001
108
US
I have a datetime field that I want to use as a parameter field using only the date (exclude time) as the parameter. If I use the DateTimeToDate function the field doesn't show up when I try to create the parameter. I also need the parameter to be a date range. Any suggestions. Thanks in advance for you help.
 
Go to file->report options and select "Convert datetime to date". Then when you create the parameter the date fields will be available in the dropdown browse list without your needing to create a formula to convert them.

-LB
 
Thanks lbass and thanks for the quick response
 
You can also use a formula to convert them, as in:

cdate({table.datetime})

Then reference the formula in the Record Selection Formula.

@date = {MyParm}

The key is to make sure that it's passed to the database, so check Database->Show SQL Query to make sure. This is key to performance, getting it to use it is less critical thern making sure that it's passed. I believe that LB's solution will pass, but check it.

If it doesn't show up, use the following as the formula:

cdate(year({table.datetime}),month({table.datetime}),day({table.datetime}))

-k
 
Thanks synapsevampire. This is what I was originally looking for. Although the other way is easier this is also good to know.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top