Wildcard, Like in Vba
Posted on 2014-03-10
I use to following codeto open a report based on the Customer and the site Location.
Private Sub PreviewReport_Click()
On Error GoTo Err_Command6_Click
Dim stDocName As String
stDocName = "FGasStatusReport"
DoCmd.OpenReport stDocName, acPreview, , "[Customer] = Forms!FGasReport!Combo0 and [SiteLocation] = Forms!FGasReport!Combo2"
If a customer has multiple sites I want the option to report all sites on one report or by selected sites.
For example: using the code above I would have to run 5 separate reports for a customer with 5 sites (which is not always what is wanted).
I can get it work in a query using Nz(([Customer] = Forms!FGasReport!Combo0]),"*"))), but would like to do this in VBA