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

Building date range selection

Status
Not open for further replies.
Feb 19, 2003
2
US
I know this is probably easy - but we are having difficulties

I have a report that is date driven. I want to prompt the user for the begin and end date to filter the contents of the report. I want the user to enter 07012003 and this date is used to compare against a date/time stamp field in the database.

Any help is appreciated.

 
There are a fwe ways to accomplish this. What I usually do is create two global string variables: gBeginDate, gEndDate.

Override the ObtainSelectStatement (BEFORE the call to Super::ObtainSelectStatament() ) and do something like:

WhereClause = WhereClause & " And db.datecolumn between '" & Format(gBeginDate, "mm/dd/yyyy") & "' and '" & Format(gEndDate, "mm/dd/yyyy") & "'"

Don't forget to check to make sure there is a where clause (the above assumes there is and starts with " And..." as well as formatting to your database.



Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top