I have a sub form that by default loads with all OS avaliable. I have added a combo box to the main form with all 4 options of OS that will display, I want the user to be able to select an OS from the combo box and the sub-form auto-filter to that selected OS.
I have this syntax - but I get a dialog box asking me to input the OS so it seems that I have not properly passed the value from the combo box to the procedure? How should I set this up so it functions as I desire?
Code:
Private Sub cboFilterStat_AfterUpdate()
On Error GoTo Proc_Error
If IsNull(Me.cboFilterStat) Then
Me.[_Test].Form.Filter = ""
Me.[_Test].Form.FilterOn = False
Else
Me.[_Test].Form.Filter = "[OS]=" & Me.cboFilterStat
Me.[_Test].Form.FilterOn = True
End If
Proc_Exit:
Exit Sub
Proc_Error:
MsgBox "Error " & Err.Number & " in setting subform filter:" & vbCrLf & Err.Description
Resume Proc_Exit
End Sub