A family of Microsoft relational database management systems designed for ease of use.
You need code in two places: in the After Update event of the check box, so that the row source gets changed when the user clicks the check box, and in the On Current event of the form, so that the row source is kept up-to-date as the user moves from record to record.
Private Sub chk_FlagFilter_AfterUpdate()
Call UpdateRowSource
End Sub
Private Sub Form_Current()
Call UpdateRowSource
End Sub
Private Sub UpdateRowSource()
If Me.chk.FlagFilter = True Then
Me.NameOfCombo.RowSource = "SELECT form_num FROM Tbl_BatchData " & _
"WHERE ([Forms]![Brwse_Edit_Frm]![cmb_BatchNo])=[Batch_Num] " & _
" AND [Forms]![Brwse_Edit_Frm]![cmb_Flag]=[flag]"
Else
Me.NameOfCombo.RowSource = "SELECT form_num FROM Tbl_BatchData " & _
"WHERE [Forms]![Brwse_Edit_Frm]![cmb_BatchNo]=[Batch_Num]"
End If
End Sub
where NameOfCombo is the name of the combo box whose row source you want to change.