I search the Forum and Knowledge base for this topic, but was unsuccessful.
Here is the problem,
I'm inserting the value of a textbox into a table. I'm doing that with the following code:
Set cmdInsertCode = New ADODB.Command
cmdInsertCode.ActiveConnection = cnx1
cmdInsertCode.CommandText = "insert into tblExhibitACodes (ContractCodeID, PostID," & _
"PostContractCode, Location, Function)" & _
"values ('" & PostContractCodeID & "','" & intPostID & _
"','" & txtPostContractCode & " ','" & txtLocation & "','" & txtFunction & "')"
cmdInsertCode.Execute
I also tried assigning the value of the textbox to a variable string
with str = """ & txtLocation & """ and inserting the string that didn't work.
I tried str = " & ch(39) & " & txtLocation & " & ch(39) & " - didn't work
Does anyone knows how to insert text that might contain a single quote into a table using the insert into command?
Thanks,
Maritza
Here is the problem,
I'm inserting the value of a textbox into a table. I'm doing that with the following code:
Set cmdInsertCode = New ADODB.Command
cmdInsertCode.ActiveConnection = cnx1
cmdInsertCode.CommandText = "insert into tblExhibitACodes (ContractCodeID, PostID," & _
"PostContractCode, Location, Function)" & _
"values ('" & PostContractCodeID & "','" & intPostID & _
"','" & txtPostContractCode & " ','" & txtLocation & "','" & txtFunction & "')"
cmdInsertCode.Execute
I also tried assigning the value of the textbox to a variable string
with str = """ & txtLocation & """ and inserting the string that didn't work.
I tried str = " & ch(39) & " & txtLocation & " & ch(39) & " - didn't work
Does anyone knows how to insert text that might contain a single quote into a table using the insert into command?
Thanks,
Maritza