Re: Closing Delimiter error
- From: "Sylvain Lafontaine" <sylvain aei ca (fill the blanks, no spam please)>
- Date: Thu, 28 Feb 2008 18:56:41 -0500
When building a sql string, if you are using the single quote as the string
delimiter, then you must use double single quotes inside it; when it's
double quotes, you must use double double quotes. The situation is also
more complicated because the situation can repeat itself with the VBA
strings when you are using the double quotes for you sql string delimiters.
In your case, try replacing « Comments » with « Replace (Comments, "'",
"''") ». It's a good idea to display the result of strSql after that to
verify that everything is OK.
--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)
"AkAlan via AccessMonster.com" <u18147@uwe> wrote in message
news:806b8c5b5e100@xxxxxx
Hi All, I am getting an error when there is an apostrophe in the Comments
text box. I tried using double double quotes in place of the single quotes
but get a different error then. Here is the code I use, thanks for any
help.
strSql = "INSERT INTO tblPmiHistory (PmiId,EquipId,Employee,StartDate,
FinishDate,DateSchedOriginal, " _
& " DateSchedCurrent,Comments,TaskId,PerfWc )" _
& " VALUES ('" & Me.PmiId & "','" & Me.EquipId & "','" &
Me.Employee
& "','" & Me.StartDate & "','" _
& Me.FinishDate & "','" & Me.DateSchedOriginal & "','" & Me.
DateSchedCurrent & "','" _
& Comments & "','" & Me.TaskId & "','" & Me.txtPerfWc & "'" & ")"
--
Message posted via http://www.accessmonster.com
.
- References:
- Closing Delimiter error
- From: AkAlan via AccessMonster.com
- Closing Delimiter error
- Prev by Date: Closing Delimiter error
- Next by Date: Re: Username and Password Pop-Up
- Previous by thread: Closing Delimiter error
- Index(es):
Relevant Pages
|