Can you help me with the code? thanks
Create an unbound cbo box on the form with the following:
ColumnCount: 1
RowSourceType: Value List
Row Source: "All";"Active";"Inactive"
Default Value: "Active"
Set up a qry with all the reqd flds for the form.
To open so that only Active shows:
OnOpen event or put it in a cmd button to open the form:
strSQL = "(qryMyQuery.Active) = True"
DoCmd.OpenForm "frmMyForm", acNormal, "qryMyQuery", strSQL, acEdit, acNormal
In the AfterUpdate event of the cbo box put:
Me.Refresh
EventFilled
EventFilled is a procedure as follows:
Sub EventFilled()
If Me.cboMyCbo = "All" Then
DoCmd.RunCommand acCmdRemoveFilterSort
ElseIf Me.cboMyCbo = "Active" Then
strSQL = "(qryMyQuery.Active) = True"
DoCmd.OpenForm "frmMyForm", acNormal, "qryMyQuery ", strSQL, acEdit, acNormal
ElseIf Me.cboMyCbo = "Inactive" Then
strSQL = "(qryMyQuery .Active) = False"
DoCmd.OpenForm "frmMyForm", acNormal, "qryMyQuery ", strSQL, acEdit, acNormal
End If
End Sub
Change qryMyQuery, frmMyForm and cboMyCbo to the names you are using.
Don't forget to
Dim strSQL
Good Luck