SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Date range defaults


Date range defaults

Author
Message
DaveDB
DaveDB
SSC-Enthusiastic
SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)

Group: General Forum Members
Points: 161 Visits: 215
Hello and happy Friday!

I have a several reports that accept date range parameters. These are not the textboxes that show you a calendar when you click the box, but just 2 simple textboxes (Startdate and Enddate). Is there a way for me to force the user to type in a date range in 'mm/dd/yyyy' format? Also is there a way where I can at least have 'mm/dd/yyyy' as a default in the textboxes so they know what format to use or prehaps a default date range for the current day dynamically hardcoded into the date range text boxes?


Here is the code that I have in the dataset properties. Thank you all in advance.

Select * from v_SQL_VIEW
WHERE Dates Between @Startdate and @Enddate
order by 1
robert.gerald.taylor
robert.gerald.taylor
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1820 Visits: 1493
DaveDB (11/1/2013)
I have a several reports that accept date range parameters. These are not the textboxes that show you a calendar when you click the box, but just 2 simple textboxes (Startdate and Enddate). Is there a way for me to force the user to type in a date range in 'mm/dd/yyyy' format? Also is there a way where I can at least have 'mm/dd/yyyy' as a default in the textboxes so they know what format to use or prehaps a default date range for the current day dynamically hardcoded into the date range text boxes?

Why wouldn't you use the date/time parameter data type. The user can enter a date in the textbox portion of the control, or use the calendar if they choose to graphically select the date. You can use an expression to set the default values. Putting this into a string is recreating the wheel.

Rob
DaveDB
DaveDB
SSC-Enthusiastic
SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)

Group: General Forum Members
Points: 161 Visits: 215
Thanks Rob. I will look into this option.
DaveDB
DaveDB
SSC-Enthusiastic
SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)SSC-Enthusiastic (161 reputation)

Group: General Forum Members
Points: 161 Visits: 215
That worked perfect! I thought that because my report is looking at the date parameter as a string in my view that it wouldn't work and I would get a conversion error. Much appreciated Smile
robert.gerald.taylor
robert.gerald.taylor
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1820 Visits: 1493
I'm happy that worked out and I'm glad to help.

Rob
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search