dbpQuery - Syntax Error in where and missing operation. - Forum

Forum Navigation
You need to log in to create posts and topics.

dbpQuery - Syntax Error in where and missing operation.

I have created a dbpQuery and am getting errors. The code has work in another project but not in this one.

SetVar "[Filter]" ""

If "[sGROUP]" ">" ""
  SetVar "[Filter]" "GROUP LIKE [#34]%[sGROUP]%[#34]"
EndIf

If "[sTYPE]" ">" ""
  If "[Filter]" ">" ""
    SetVar "[Filter]" "[Filter][Operator]"
  EndIf
  SetVar "[Filter]" "[Filter] TYPE LIKE [#34]%[sTYPE]%[#34]"
EndIf

If "[sVOL]" ">" ""
  If "[Filter]" ">" ""
    SetVar "[Filter]" "[Filter] [Operator]"
  EndIf
  SetVar "[Filter]" "[Filter] VOL LIKE [#34]%[sVOL]%[#34]"
EndIf

If "[sPAM]" ">" ""
  If "[Filter]" ">" ""
    SetVar "[Filter]" "[Filter] [Operator]"
  EndIf
  SetVar "[Filter]" "[Filter] PAM LIKE [#34]%[sPAM]%[#34]"
EndIf

If "[sPART]" ">" ""
  If "[Filter]" ">" ""
    SetVar "[Filter]" "[Filter] [Operator]"
  EndIf
  SetVar "[Filter]" "[Filter] PART LIKE [#34]%[sPART]%[#34]"
EndIf

If "[sYEAR]" ">" ""
  If "[Filter]" ">" ""
    SetVar "[Filter]" "[Filter] [Operator]"
  EndIf
  SetVar "[Filter]" "[Filter] PDATE LIKE [#34]%[sPDATE]%[#34]"
EndIf

If "[Filter]" ">" ""
  dbpQuery "Mydatabase" "MilitaryManuals" "[Filter]"
  If "[MyDatabase.MilitaryManuals.$RecCount]" "=" "0"
    AlertBox "Query" "No matching records found."
    dbpShowAll "Mydatabase" "MilitaryManuals"
  EndIf
Else
  dbpShowAll "Mydatabase" "MilitaryManuals"
EndIf
dbpRefresh "Mydatabase" "MilitaryManuals"

First problem is that the "Group" search shows " Syntex Error in Where Clause" regardless

Second is more of a puzzle, Type search works on its own, but not with Vol, Pam, Part fields, but does work if you only use Type and PDate.

I have printed both codes and looked at them line by line, and am unable to see an error with it.

Can anyone point me to the problem, please

 

En esta parte del código revisas si la variable [sYEAR] no está vacía, pero al momento de usarla escribes erróneamente la variable [sPDATE].

If "[sYEAR]" ">" ""
If "[Filter]" ">" ""
SetVar "[Filter]" "[Filter] [Operator]"
EndIf
SetVar "[Filter]" "[Filter] PDATE LIKE [#34]%[sPDATE]%[#34]"
EndIf

dbpQuery not recommended, you most use dbpExecSql
Syntax Correct in Access need ( )

(((FILTER1 AND FILTER2 ) AND FILTER3 ) AND FILTER4)

Syntax Correct en MySQL

FILTER1 AND FILTER2 AND FILTER3 AND FILTER4