I already tried it with the space before I post and it gives me the error
Here is the code:
'sélection d'un business group
If cboBussGroup.Value <> "" Then
strCond = "BusinessGroup like '" & Me.cboBussGroup.Value & "'"
ElseIf IsNull(cboBussGroup.Value) Then
strCond = strCond
End If
'sélection du surplus
If Check7 = True Then
strCond = strCond & " And Surplus = True"
ElseIf Check9 = True Then
strCond = strCond & " And Surplus = False"
ElseIf Check7 = False And Check9 = False Then
strCond = strCond
End If
'sélection d'un property type
If cboPropType.Value <> "" Then
strCond = strCond & " And PropertyType like '" &
Me.cboPropType.Value & "'"
ElseIf IsNull(cboPropType.Value) Then
strCond = strCond
End If
'sélection d'un continent
If cboContinent.Value <> "" Then
strCond = strCond & " And Continent like '" & Me.cboContinent.Value
& "'"
ElseIf IsNull(cboContinent.Value) Then
strCond = strCond
End If
'sélection d'un pays
If cboCountry.Value <> "" Then
strCond = strCond & " And Pays like '" & Me.cboCountry.Value & "'"
ElseIf IsNull(cboCountry.Value) Then
strCond = strCond
End If
'CONSTRUCTION DE LA CLAUSE WHERE AVEC SORTING
If cboSort1.Value = "Not Sorted" Or IsNull(cboSort1) Then
strCond = strCond & " ORDER BY BusinessGroup,Pays"
Else
strCond = strCond & "[" & Me.cboSort1.Value & "]"
End If
' Debug.Print strCond
'open report
DoCmd.OpenReport stDocName, acPreview, , strCond
If Err.Number = 2501 Then Err.Clear
Alain
Brendan Reynolds said:
You might be missing a space. Try ...
strCond = strCond & " Order By .. etc"
Note the space in front of 'Order By'.
If that's not it, try posting enough of the code so that we can see what
strCond may already contain before the 'Order By' clause is appended.
--
Brendan Reynolds
Hi to all,
I and trying to build a string condition to use with the
Docmd.OpenReport, in that sting, I need to insert the ORBER BY
condition but when I do I get the error 3075 Syntax error....missing
operator in query expression.....
If I do not add the ORDER BY condition , all the other condition (Where
Clause) are working just great
If cboSort1.Value = "Not Sorted" Or IsNull(cboSort1) Then
strCond = strCond & "ORDER BY BusinessGroup,Pays"
Else
...........
End If
'open report
DoCmd.OpenReport stDocName, acPreview, , strCond
If Err.Number = 2501 Then Err.Clear
TIA
Alain