Syntax Error - Missing operator in query expression

frispee

Registered User.
Local time
Today, 02:50
Joined
May 23, 2012
Messages
28
Hi,

I have a split form which I am filtering based on selections from two cascading combo boxes. The filter works fine with the first combo. But when both the first and second filter is applied, I get a syntax error. The piece of code that I am using in the after update event of the second combo is:

Code:
Me.Filter = "[Group Description] = " & Me.FGroup_cbx & " AND [Program]=" & Me.FProgram_cbx

Can anyone please tell what I am missing? Thanks in advance :)
 
Looks okay presuming both are numeric fields (is description?) You might set a breakpoint or add Debug.Print or a message box to make sure the filter is coming out how you expect.
 
I suspect that one of your combo boxes is returning Null or zero-length string.
 
And I believe that at least one of the fields (DESCRIPTION?) is text and needs quotes.
Code:
Me.Filter = "[Group Description] = " & Chr(34) & Me.FGroup_cbx & Chr(34) & " AND [Program]=" & Me.FProgram_cbx
And if both are text
Code:
Me.Filter = "[Group Description] = " & Chr(34) & Me.FGroup_cbx & Chr(34) & " AND [Program]=" & Chr(34) & Me.FProgram_cbx & Chr(34)
 

Users who are viewing this thread

Back
Top Bottom