I mentioned you should pay attention to spaces and concatenation. Take a look at the red part of the code I posted and take your time to work it out.
strFilter = "[Total Hours Worked] Is Null[COLOR=Red]" And "[/COLOR] & _
"[Engineer 1] = '" & Me!cbrEngineer & "[COLOR=Red]'Or "[/COLOR] & _
strFilter = "[Total Hours Worked] Is Null [COLOR=Blue]And "[/COLOR] & _
"[Engineer 1] = '" & Me!cbrEngineer & "[COLOR=Red]'Or "[/COLOR] & _
There's such a thing as trial and error. There needs to be a space somewhere. Put some effort into it.![]()
I'm doing it because it's xmas
Can you see it now?Code:strFilter = "[Total Hours Worked] Is Null [COLOR=blue]AND "[/COLOR] & _ "[Engineer 1] = '" & Me!cbrEngineer & "[COLOR=blue]' OR "[/COLOR] & _
You still have problems with your other code lines. You will need to fix those too.
ElseIf Me.chkIncompleted = True And Me.cbrEngineer & "" <> "" Then
strFilter = "[Total Hours Worked] Is Null And " & _
"[Engineer 1] = '" & Me!cbrEngineer & "' OR " & _
"[Total Hours Worked] Is Null" And " & _
"[Engineer 2] = '" Me!cbrEngineer & "' OR " & _
"[Total Hours Worked] Is Null And " & _
"[Engineer 3] = '" & Me!cbrEngineer & "'"
DoCmd.Close
DoCmd.OpenReport "VisitSheetTableReport", acViewReport, , strFilter
ElseIf Me.chkIncompleted = True And Me.cbrEngineer & "" <> "" Then
strFilter = "[Total Hours Worked] Is Null And " & _
"[Engineer 1] = '" & Me!cbrEngineer & "' OR " & _
"[Total Hours Worked] Is Null And " & _
"[Engineer 2] = '" Me!cbrEngineer & "' OR " & _
"[Total Hours Worked] Is Null And " & _
"[Engineer 3] = '" & Me!cbrEngineer & "'"
DoCmd.Close
DoCmd.OpenReport "VisitSheetTableReport", acViewReport, , strFilter
And what??
You just posted code without explaining whether it's working or not. We're not psychic you know (even if we try to be)
Why is this repeated three times?
"[Total Hours Worked] Is Null And "
strFilter = "[Total Hours Worked] Is Null And (" & _
"[Engineer 1] = '" & Me!cbrEngineer & "' OR " & _
"[Engineer 2] = '" Me!cbrEngineer & "' OR " & _
"[Engineer 3] = '" & Me!cbrEngineer & "')"
We've seen otherwise from other posters.
Alright, I get you:
If that doesn't work then cbrEngineer is returning Null or zero-length string or there's some other code above that's causing the syntax error.Code:strFilter = "[Total Hours Worked] Is Null And (" & _ "[Engineer 1] = '" & Me!cbrEngineer & "' OR " & _ "[Engineer 2] = '" Me!cbrEngineer & "' OR " & _ "[Engineer 3] = '" & Me!cbrEngineer & "')"