Filter with Checkbox

Sketchin

Registered User.
Local time
Today, 04:16
Joined
Dec 20, 2011
Messages
580
Hi all,

I have a form with a checkbox and a combo box. When I click the checkbox, I would like it to only show the specified records that are in the combo box. The current code I have is this:

Code:
Private Sub chkHideComplete_AfterUpdate()
On Error Resume Next
    If Me.chkHideComplete = True Then
        Me.filter = "[ReservationStatus] = 3"
        Me.FilterOn = False

    Else
         Me.filter = "[ReservationStatus] = 1" Or "[ReservationStatus] = 2" Or "[ReservationStatus] = 4" Or "[ReservationStatus] = 5"
        Me.FilterOn = True

    End If

     DoCmd.GoToRecord , "", acLast
     Me.cboContactID.Requery
End Sub

I basically want to hide all records that have "1" in the combo box.
 
You will need to add the criteria for your field ReservationStatus to the SQL row source for the Combobox and in the checkbox after update event, add me.combobox.requery to update the combobox row source.
 
Sorry, I want to filter the records in the form, not the combobox itself.
 

Users who are viewing this thread

Back
Top Bottom