More Information
In order to filter a report using preset date ranges you must perform two steps. The first is to setup your
query with special field specifiers that tell the report writer where to insert the dates. The second step is to
write code that replaces the field specifiers in your query with actual date values.
Step 1
- Use the Query Builder to create and edit the query as required for your report. Insert actual date ranges where required for testing.
- Once the report have been created, edit the query and replace the actual dates with special field specifiers. For example replace the starting date with <<startdate>> and the end date with <<enddate>>.
Step 2
- From the View menu click Code.
- From the section list select Document.
- From the event list select OnReportStart.
- Add the following code to the OnReportStart procedure.
rpt.Sections("Detail").Controls("DataControl1").Source =
Replace(rpt.Sections("Detail").Controls("DataControl1").Source,"<<startdate>>",CStr(swcsAssistant.Get
Date(9)))
rpt.Sections("Detail").Controls("DataControl1").Source =
Replace(rpt.Sections("Detail").Controls("DataControl1").Source,"<<enddate>>",CStr(swcsAssistant.Get
Date(10)))
Replace GetDate(9) and GetDate(10) with the specific values you need. See Notes for more information.
Notes
- Supported GetDate values:
1 = Last month start date
2 = Last month end date
3 = Last week start date
4 = Last week end date
5 = Month start date; Pass a date as the first parameter.
6 = Month end date; Pass a date as the first parameter.
7 = Current month start date
8 = Current month end date
9 = Current week start date
10 = Current week end date
11 = Week start date; Pass a date as the first parameter.
12 = Week end date; Pass a date as the first parameter.
13 = Recent start date (3 weeks ago)
14 = Recent end date (3 weeks from now)
15 = Today start date
16 = Today end date
17 = Yesterday start date
18 = Yesterday end date
19 = This year start date
20 = This year end date
APPLIES TO
- Solatech Report Writer 1.0
- Solatech Report Writer 1.1