G
Guest
OK, I must be the densest one here, I'll admit it.
I was having problems with looking up a value from a table when there is a
single quote in the string.
Douglas Steele suggested the following:
strSQL = "INSERT INTO requests ( [PubID], [Out], [EmployeeID],
[NameOfPublication], [Location] ) " & _
"values (" & PubID & " , '-1', " & empid & " , '" & PubName & "', " & _
" '" & Replace(loc, "'", "''") & "' );"
Well, I thought it was working, but for some reason, it isn't. The above
strSQL prints out:
INSERT INTO requests ( [PubID], [Out], [EmployeeID], [NameOfPublication],
[Location] ) values (49 , '-1', 29381 , 'Supervisor's Portable Answer Book',
'address' );
but gives an error message:
(quote)
Syntax error (missing operator) in query expression "Supervisor's Portable
Answer Book', 'address' );'.
(end quote)
EmpID is a number, NameOfPublication is text
I can't find the error. Help.
tia,
I was having problems with looking up a value from a table when there is a
single quote in the string.
Douglas Steele suggested the following:
strSQL = "INSERT INTO requests ( [PubID], [Out], [EmployeeID],
[NameOfPublication], [Location] ) " & _
"values (" & PubID & " , '-1', " & empid & " , '" & PubName & "', " & _
" '" & Replace(loc, "'", "''") & "' );"
Well, I thought it was working, but for some reason, it isn't. The above
strSQL prints out:
INSERT INTO requests ( [PubID], [Out], [EmployeeID], [NameOfPublication],
[Location] ) values (49 , '-1', 29381 , 'Supervisor's Portable Answer Book',
'address' );
but gives an error message:
(quote)
Syntax error (missing operator) in query expression "Supervisor's Portable
Answer Book', 'address' );'.
(end quote)
EmpID is a number, NameOfPublication is text
I can't find the error. Help.
tia,