Below is what I have, but when I try to filter the report using the selected text in the combo box, it will not filter.
Could someone help me and what I did wrong.
Private Sub Command4_Click()
On Error GoTo MyErr
If IsNull(Me.Combo0) Then
MsgBox "No data found! Closing report.", vbCritical, "Select location.."
Me.Combo0.SetFocus
Else
If Not IsNull(Me.Combo0) Then
strFilter = "[myfield1]= " & Me.Combo0
strFilter = "[myfield2]= " & Me.Combo2
DoCmd.OpenReport "myreport", acViewPreview
MyExit:
Exit Sub
MyErr:
If Err.Number <> 2501 Then
MsgBox Err.Description
End If
Resume MyExit
End If
End If
End Sub
Could someone help me and what I did wrong.
Private Sub Command4_Click()
On Error GoTo MyErr
If IsNull(Me.Combo0) Then
MsgBox "No data found! Closing report.", vbCritical, "Select location.."
Me.Combo0.SetFocus
Else
If Not IsNull(Me.Combo0) Then
strFilter = "[myfield1]= " & Me.Combo0
strFilter = "[myfield2]= " & Me.Combo2
DoCmd.OpenReport "myreport", acViewPreview
MyExit:
Exit Sub
MyErr:
If Err.Number <> 2501 Then
MsgBox Err.Description
End If
Resume MyExit
End If
End If
End Sub