Link to home
Start Free TrialLog in
Avatar of jose11au
jose11auFlag for Australia

asked on

Date range parameter script

Hi All
I need your assistance. I have the code below using two parameters, @datefrom and @dateto. This code is to restrict the user to a maximum date range of 100 days.

For example, if the user selects todays date from @dateto parameter then the user can go back to a maximum of 100 days when selecting a date from the @datefrom parameter and show data according to data range specified.

Can anyone please help to modify code accordingly .

Many thanks.

Function CheckDateParameters(p_BUS_DATE as Date, p_DateTo as Date) as Integer
Dim msg as String
     msg = "" 
     If (DateAdd("d",-400,p_BUS_DATE) < p_DateTo )  Then
 msg="Start Date should not be later than End Date"
     End If
     If msg <> "" Then
 MsgBox(msg, 16, "Report Validation")
     End If
End Function
Avatar of Bill Prew
Bill Prew

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jose11au


Thanks so much for your help. Apologies for the delay.
Avatar of Bill Prew
Bill Prew

Welcome, glad that helped.