G
gsam
In Access 2007 I’m using an ActiveX grid to add, delete or edit data saved to
a SQL Database. I need to update a field that will contain the description of
a product. My problem is that I must prepare for the description to contain
both quotations and apostrophes. For example, a sales person might enter the
following into the description field.
And I quote "the dragon's burnt toothâ€, is what he said.
The SQL Update statement that I’m using to save the data is:
Dim sql as string
sql = "UPDATE tblOrderDetail SET [Description] = " _
& Chr(34) & iGrid3.CellValue(lRow, 6) & Chr(34) _
& " WHERE tblOrderDetail.DetailID = " _
& iGrid3.CellValue(lRow, "DetailID")
CurrentProject.Connection.Execute sql
By entering the above description the sql string would look like this and
throw an error:
UPDATE tblOrderDetail SET [Description] = "And I quote "the dragon's burnt
tooth", is what he said." WHERE tblOrderDetail.DetailID = 605
Does anyone have a suggestion on how I correctly enter data that might
contain any number of quotations and apostrophes?
a SQL Database. I need to update a field that will contain the description of
a product. My problem is that I must prepare for the description to contain
both quotations and apostrophes. For example, a sales person might enter the
following into the description field.
And I quote "the dragon's burnt toothâ€, is what he said.
The SQL Update statement that I’m using to save the data is:
Dim sql as string
sql = "UPDATE tblOrderDetail SET [Description] = " _
& Chr(34) & iGrid3.CellValue(lRow, 6) & Chr(34) _
& " WHERE tblOrderDetail.DetailID = " _
& iGrid3.CellValue(lRow, "DetailID")
CurrentProject.Connection.Execute sql
By entering the above description the sql string would look like this and
throw an error:
UPDATE tblOrderDetail SET [Description] = "And I quote "the dragon's burnt
tooth", is what he said." WHERE tblOrderDetail.DetailID = 605
Does anyone have a suggestion on how I correctly enter data that might
contain any number of quotations and apostrophes?