jordanking
Programmer
- Sep 8, 2005
- 351
Hello
I am having trouble passing a string variable to an append query based on values.
if I debug.print the value of the string created it returns:
I get the following error:
"Syntax Error, (missing Operator) in Expression '*BD- Serink'"
I need to be able to pass the value of the string including commas in a way that does not effect the execution of the query. If I make all the variables numeric then it works. But it breaks if the variables are strings(with or wihtout commas).
Any suggestions greatly appreciated.
Thank You
JK
I am having trouble passing a string variable to an append query based on values.
Code:
lCusID = 529
strCusNm = "*BD- Serink, Rosemarie"
dCrntTtl = 0
dAgdTtl = 0
dAmtTtl = 0
strAppend = "INSERT INTO tblSDBCust ( lID, strName, curCurrent, curAged, curTotal ) VALUES ( " & lCusID & ", " & strCusNm & ", " & dCrntTtl & ", " & dAgdTtl & ", " & dAmtTtl & " );"
DoCmd.RunSQL strAppend
if I debug.print the value of the string created it returns:
Code:
INSERT INTO tblSDBCust ( lID, strName, curCurrent, curAged, curTotal ) VALUES ( 529, *BD- Serink, Rosemarie, 0, 0, 0 );
I get the following error:
"Syntax Error, (missing Operator) in Expression '*BD- Serink'"
I need to be able to pass the value of the string including commas in a way that does not effect the execution of the query. If I make all the variables numeric then it works. But it breaks if the variables are strings(with or wihtout commas).
Any suggestions greatly appreciated.
Thank You
JK