Update to table problem

  • Thread starter Thread starter Les
  • Start date Start date
L

Les

I am using the following to attemp to update my "tblProduct_List" firld
"strDescription"

I keep getting an Undfined variable error.

All the fields are text and the variables show the correct values. I have
also double checked the field names.

Any ideas. I suspect its the "" as I am struggling to get my head round
when you use' ' or " ".


Dim strsql As String
Dim Details As String
Dim Prdt As String
Prdt = strProduct
Details = strDescription

strsql = "UPDATE tblProduct_List SET Description = " & strDescription & "
WHERE Product = '" & Prdt & "'"

CurrentDb.Execute strsql, dbFailOnError
 
Les said:
I am using the following to attemp to update my "tblProduct_List" firld
"strDescription"

I keep getting an Undfined variable error.

All the fields are text and the variables show the correct values. I have
also double checked the field names.

Any ideas. I suspect its the "" as I am struggling to get my head round
when you use' ' or " ".


Dim strsql As String
Dim Details As String
Dim Prdt As String
Prdt = strProduct
Details = strDescription

strsql = "UPDATE tblProduct_List SET Description = " & strDescription & "
WHERE Product = '" & Prdt & "'"

CurrentDb.Execute strsql, dbFailOnError


This should work:

strsql = "UPDATE tblProduct_List SET Description = """ _
& strDescription & """ WHERE Product = '" & Prdt & "'"

That demonstrates how to use " inside a string as well as
your alternative use of '
 
Marshal that works fine thanks

Les

Marshall Barton said:
This should work:

strsql = "UPDATE tblProduct_List SET Description = """ _
& strDescription & """ WHERE Product = '" & Prdt & "'"

That demonstrates how to use " inside a string as well as
your alternative use of '
 
Thanks marshall thats great

Marshall Barton said:
This should work:

strsql = "UPDATE tblProduct_List SET Description = """ _
& strDescription & """ WHERE Product = '" & Prdt & "'"

That demonstrates how to use " inside a string as well as
your alternative use of '
 
Back
Top