Filter Form and Syntax
Hello Experts,
I am trying to filter a form based on a combo box and I need 2 criteria. I can filter with 1 criteria no issue but adding another criteria that is TEXT is the problem.
In the below, [ExpiredYN] is a cbo with a row source: “Terminated”;”Active”.
[ProjIDfk] is not text.
do you see where I am wrong?
Private Sub cboFilterProj_AfterUpdate()
‘http://allenbrowne.com/ser-28.html
If IsNull(Me.cboFilterProj) Then
Me.FilterOn = False
Else
Me.Filter = “ProjIDfk = ” & Me!cboFilterProj & “‘ And [ExpiredYN] = ‘” & Me!cboStatus & “‘“
^dqsq ^sqdq ^dqsqdq
the above returns a syntax:
Me.Filter = “ProjIDfk = ” & Me!cboFilterProj & “‘ And ” & [ExpiredYN] = ‘” & Me!cboStatus & “‘“
^dqsq ^?? ^sqdq ^dqsqdq
I get a compile error on the above:
Me.FilterOn = True
End If
End Sub
thank you
Hello Experts, I am trying to filter a form based on a combo box and I need 2 criteria. I can filter with 1 criteria no issue but adding another criteria that is TEXT is the problem. In the below, [ExpiredYN] is a cbo with a row source: “Terminated”;”Active”. [ProjIDfk] is not text. do you see where I am wrong? Private Sub cboFilterProj_AfterUpdate()’http://allenbrowne.com/ser-28.htmlIf IsNull(Me.cboFilterProj) ThenMe.FilterOn = FalseElseMe.Filter = “ProjIDfk = ” & Me!cboFilterProj & “‘ And [ExpiredYN] = ‘” & Me!cboStatus & “‘” ^dqsq ^sqdq ^dqsqdqthe above returns a syntax: Me.Filter = “ProjIDfk = ” & Me!cboFilterProj & “‘ And ” & [ExpiredYN] = ‘” & Me!cboStatus & “‘” ^dqsq ^?? ^sqdq ^dqsqdqI get a compile error on the above: Me.FilterOn = TrueEnd IfEnd Sub thank you Read More