code in Case Select to open union query based report

starrcruise

Registered User.
Local time
Today, 12:06
Joined
Mar 4, 2011
Messages
18
I have searched everywhere for help on this. I hope you're my saviors again. I have a switchboard form that has a combo control with lists of reports to be chosen. In the VBA of control, I have a case select. (pasted below). I currently have the code below opening a report (built on a union query) when the "Division Affected" field equals the input box. It works perfectly.

Case 5 'opens Compliance open items report by Division
If Me.cboReportTask = 5 Then
strDiv = InputBox("Please enter Division Name:" _
& vbCrLf & "Retail, Correspondent, Wholesale," _
& vbCrLf & "RTL/WHSL, RTL/CORR, WHSL/CORR")
strCondition = "[Division Affected]='" & strDiv & "'"
DoCmd.OpenReport "rptComplianceOpenItems", acViewReport, , strCondition
Me.cboReportTask = ""
End If

Now I need it to open as follows:
If "Retail" entered in input box, then if "Division Affected" = "Retail", or "RTL/Whsl", or "Rtl/Corr", it will be pulled.

I tried entering an If statement
If strDiv = "Retail" Then _
StrCondition = [Division Affected]=???????
However, I do not know how to set up the StrCondition statement. several attempts resulted in mismatch 13 error, another was 2465 '|' field cannot be found. I am obviously not referring to the field properly in my string, or my syntax is wrong. I'm lost. Thank you for your help in advance.
 

Users who are viewing this thread

Back
Top Bottom