Whereclause "and" syntax

Trying to get customer part data and I can’t seem to get the syntax correct.
Need a bit of help because I have tried and just can’t get it to work.

WhereClauses.Add(“CustXPrt”, “CustNum=’” & intCustNum & “’”) works to get all customer parts, but

WhereClauses.Add(“CustXPrt”, “CustNum=’” & intCustNum & “’” and “XPartNum=’” & strxPartNum & “’”) gives the error below.
Conversion from string “CustNum=‘1’” to type ‘Long’ is not valid.

I must have quotes or an apostrophe in the wrong spot somewhere for 2 parameters.

Against a UD table this works, but is different syntax because of the false instead of second parameter.
wherClauses.Add(“UD01”, “Character08=’” & JobNum & “’ and checkbox02 = false”)

CustNum is an integer so you don’t need quotes around it.

1 Like

So this compiles fine, but error out:
The process caller failed to invoke method InvokeSearch

WhereClauses.Add(“CustXPrt”, “CustNum=” & intCustNum & " and XPartNum=" & strXPartNum &"")

These darn apostrophes and double quotes always get me.

Think you need the apostrophe for the string.

WhereClauses.Add(“CustXPrt”, “CustNum=” & intCustNum & " and XPartNum=’” & strxPartNum & “’”)

OK got it going. There was also no space before the and in my code and that gave this.
Invalid Where-Clause: Alpha compare against Numeric Column: ‘CUSTNUM=1AND XPARTNUM=‘1035TESTPART2’’

Once I put the space in it started working.