Datasheet form filter combo box with specific value and blanks (1 Viewer)

Hedge01

New member
Local time
Today, 21:22
Joined
Dec 18, 2021
Messages
8
Hi i have a subform that is a datasheet view and i want to filter the records that have "Adam" as the value plus the records that are blank in the same field.

Private Sub Check45_Click()
If Me.Check45.Value = True Then
Me.NotEmptySubform.Form.Filter = "CTGOPP = 'Adam'" Or CTGOPP IsNull
Me.NotEmptySubform.Form.FilterOn = True
Me.NotEmptySubform.Form.Requery

Else
Me.NotEmptySubform.Form.FilterOn = False
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 19:22
Joined
May 7, 2009
Messages
19,244
Me.NotEmptySubform.Form.Filter = "(CTGOPP = 'Adam') Or (CTGOPP IsNull)"

or

Me.NotEmptySubform.Form.Filter = "(CTGOPP = 'Adam') Or IsNull(CTGOPP)"
 

Hedge01

New member
Local time
Today, 21:22
Joined
Dec 18, 2021
Messages
8
Thanks for you input I really appreciate it.

The first option returns a syntax error (missing operator) in query expression . Am i missing brackets somewhere?

The second option filters "Adam," but does not return the null values.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 19:22
Joined
May 7, 2009
Messages
19,244
i tested the 2nd and it does return the CTGOPP with Null values.

the first has error, should be:

.... Or (CTGOPP Is Null)"
 

Hedge01

New member
Local time
Today, 21:22
Joined
Dec 18, 2021
Messages
8
It works on the second line I had a naming issue that I fixed thanks so much for you help!
 

Users who are viewing this thread

Top Bottom