I have an unbound combobox on a popup form that I want to use to filter data on a report. If I choose a particular technician from the combobox, the report filters correctly. However, when I choose "All Technicians", I jump to the Else part of the code. The Locals window shows that stSelectTech has the following value:
"Tech='All Technicians'"
Dim stDocName As String, stSelectTech As String
stDocName = "rptFollowup"
stSelectTech = "Tech='" & Forms![frmTechnician]![cboTechnician] & "'"
DoCmd.Close acForm, "frmTechnician", acSaveNo
If stSelectTech = "All Technicians" Then
DoCmd.OpenReport stDocName, acViewPreview
Else
DoCmd.OpenReport stDocName, acPreview, , stSelectTech
End If
"Tech='All Technicians'"
Dim stDocName As String, stSelectTech As String
stDocName = "rptFollowup"
stSelectTech = "Tech='" & Forms![frmTechnician]![cboTechnician] & "'"
DoCmd.Close acForm, "frmTechnician", acSaveNo
If stSelectTech = "All Technicians" Then
DoCmd.OpenReport stDocName, acViewPreview
Else
DoCmd.OpenReport stDocName, acPreview, , stSelectTech
End If