Re: Report Form Design
- From: "Duane Hookom" <DuaneAtNoSpanHookomDotNet>
- Date: Tue, 18 Apr 2006 12:00:44 -0500
I place as much filtering in the where clause of the DoCmd.OpenReport method
as possible. My code might look like:
Dim strWhere as String
strWhere = "1=1 "
If Not IsNull(Me.txtActivityStart) Then
strWhere = strWhere & " And [Activity]>=#" & Me.txtActivityStart & "# "
End If
If Not IsNull(Me.txtActivityEnd) Then
strWhere = strWhere & " And [Activity]<=#" & Me.txtActivityEnd & "# "
End If
'--etc--
DoCmd.OpenReport Me.lboReportName, Me.optGrpView, , strWhere
You can't use this method to filter subreports or for some totals query
where the filtering fields are not included in the report's record source.
My more sophisticated applications have report system tables for "reports",
"criteria controls", and "report/criteria controls". When a user selects a
report, some code runs to enable or disable appropriate controls based on
the report.
--
Duane Hookom
MS Access MVP
"apollo8359" <apollo8359@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D5A3652F-D06B-493D-9975-68C9F9CF11E1@xxxxxxxxxxxxxxxx
My report form is turning out to be the most complicated form in the
database. They want combo boxes, radio buttons, date parameters with an on
and off option and four kinds of output, preview, print, snapshot and
excel.
I realize I need a case statement to handle all the options but my
question
revolves around the gathering of the desired data. I want to know which
option is the best to use and gives me the most flexibility, running a
select
statement with the criteria concatinated into the where clause, or the
docmd.openreport, with the where clause there? This has to be a common
issue
with all database designs, as a self taught rookie, where can I find a
good
example of how to get a form to dialogue with a query? I used the
following
with the open report option, but it only narrowed by REPEID, not date.
RepEID=2583 and [Opened] >=07/01/2005 and [Activity] <= 07/31/2005
Thanks in advance for any help on this.
.
- Prev by Date: Re: Report Form Design
- Next by Date: Re: Removing white space around a field in a report
- Previous by thread: Re: Report Form Design
- Next by thread: Re: Removing white space around a field in a report
- Index(es):