PDA

Click to See Complete Forum and Search --> : Simple SELECT statement problem


Spooked
Jun 7th, 2000, 03:16 PM
Set mRS = mCN.Execute("UPDATE Dies SET Die_Notes = '" & Note & "'" Where Tool_No = " & DieSelected)

Note is a string variable already declared and holds a note from an inputbox.

Dies is a table in Access 97
Die_Notes, Tool_No are fields in Access
DieSelected is the position in the datagrid


The problem is I get an Object missing error because I am not assigning the string variable Note properly. How do I add in Die_Notes = Note in to the select statement properly?

Chris
Jun 7th, 2000, 04:03 PM
Set mRS = mCN.Execute("UPDATE Dies SET Die_Notes = '" & Note & "'" Where Tool_No = " & DieSelected)


If the Tool_No Field DataType is Integer then you should do it like this:

Dim lngRecordAffected as long
mCN.Execute "UPDATE Dies SET Die_Notes = '" & Note & "' Where Tool_No =" & DieSelected & ";", lngRecordAffected, adExecuteNoRecords


If the Tool_No Field DataType is String then you should do it like this:

Dim lngRecordAffected as long
mCN.Execute "UPDATE Dies SET Die_Notes = '" & Note & "' Where Tool_No ='" & DieSelected & "';", lngRecordAffected, adExecuteNoRecords

Spooked
Jun 7th, 2000, 04:06 PM
Thanks for your help Chris, much appreciated