How do I open a report to show specific data from multiple fields?

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

Guest

Me again.
I have created a report to show a customers name, the product we have made
for them and whether or not it is in bags or bulk. I can get the queries
behind the report to ask the questions [Customer?] [Product?] [Bags or Bulk?]
but I would rather have drop down boxes for the [customer] and [product]
fields. I have tried to do it by using a form but have got in a bit of a
muddle.
Your help would be gratefully recieved again.
Thanks.
 
Middlemuir said:
I have created a report to show a customers name, the product we have made
for them and whether or not it is in bags or bulk. I can get the queries
behind the report to ask the questions [Customer?] [Product?] [Bags or Bulk?]
but I would rather have drop down boxes for the [customer] and [product]
fields. I have tried to do it by using a form but have got in a bit of a
muddle.


Create a form with the combo boxes for the three criteria.
Then add a command button to open the report. The code in
the button's Click event procedure would then be modified to
include somethng like this:

If Not IsNull(cboCustomer) Then
stCriteria = stCriteria & " AND [Customer]=" _
& cboCustomer"
End If
If Not IsNull(cboProduct) Then
stCriteria = stCriteria & " AND [Product]=" _
& cboProduct"
End If
If Not IsNull(cboBagsOrBulk) Then
stCriteria = stCriteria & " AND [Bags or Bulk]=" _
& cboBagsOrBulk"
End If
stCriteria = Mid(stCriteria, 6)
DoCmd.OpenReport stDocName, acViewPreview, , stCriteria


Be sure to modify the names I used to the ones you actually
have and the ones generated by the command button wizard.
 
Back
Top