Quote from m.burdess on November 2, 2025, 7:55 pmI 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
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
Quote from danito on November 4, 2025, 12:59 amEn 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]"EndIfSetVar "[Filter]" "[Filter] PDATE LIKE [#34]%[sPDATE]%[#34]"EndIf
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].

Quote from alangonzalez91 on November 4, 2025, 10:39 amdbpQuery 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
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