I have VBA tied to the afterupdate event on a combo box that filters various subforms on a form. I have a weekly form and a monthly form. The weekly form is filtering based on a number field and works perfectly. The monthly form is trying to filter the exact same way but using a text field. Obviously, this is not working at all. When I select a month from the combo box, it asks me for the parameter value for that month. If I type in the month the filter works, if not then it doesn't. How do I change the vba below to accurately look at text instead of numbers? Thanks.
Code:
Private Sub cmbmonth_AfterUpdate()
On Error GoTo Proc_Error
DoCmd.SetWarnings False
If IsNull(Me.cmbmonth) Then
Me.Monthly_Scores_RM_subform.Form.Filter = ""
Me.Monthly_Scores_RM_subform.Form.FilterOn = False
Else
Me.Monthly_Scores_RM_subform.Form.Filter = "[Audit_Month]=" & Me.cmbmonth
Me.Monthly_Scores_RM_subform.Form.FilterOn = True
End If
DoCmd.SetWarnings True
Proc_Exit:
Exit Sub
Proc_Error:
MsgBox "Error " & Err.Number & " in setting subform filter:" & vbCrLf & Err.Description
Resume Proc_Exit
End Sub