Creating reports based on specific criteria

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My customer database includes various customer information (name, address,
metro area…etc.), for which I would like to display in a report for an
individual customer or a group of customers based on specific criteria. I
currently have the reports designed...however, I would like to be able to
select which customers’ information will be displayed in the report by
customer name or metro area. I understand that this can been accomplished
via a report query, but I am looking for a more user friendly method, which
will allow the database user to easily insert the criteria without accessing
the report query. Perhaps this can be accomplished with a lookup field
within the report interface?

Thanks in advance.
 
Demetri said:
My customer database includes various customer information (name, address,
metro area…etc.), for which I would like to display in a report for an
individual customer or a group of customers based on specific criteria. I
currently have the reports designed...however, I would like to be able to
select which customers’ information will be displayed in the report by
customer name or metro area. I understand that this can been accomplished
via a report query, but I am looking for a more user friendly method, which
will allow the database user to easily insert the criteria without accessing
the report query. Perhaps this can be accomplished with a lookup field
within the report interface?


You should use a form to provide a place for users to enter
the criteria in text or combo boxes. Then you can also have
a button on the form that's used to prepare the criteria and
open the report. The OpenReport method's WhereCondition
argument can be used to filter the report's data without the
report or its query being aware of the filter.

Let's say you have two combo box's, one for customer and one
for area, then the button's Click event procedure would look
like:

Dim stWhere As string
Dim stDoc As String
stDoc = "nameofreport"
If Not IsNull(Me.cboNames) Then
stWhere = stWhere & " And [Name]=""" & Me.cboNames & """"
End If
If Not IsNull(Me.cboAreas) Then
stWhere = stWhere & " And [Name]=""" & Me.cboAreas & """"
End If
DoCmd.OpenReport stDoc, acViewPreview, , stWhere
 
Back
Top