Good evening, just getting my feet wet with ADO, not tired updating from sql before. Assume There is s connection then if
Dim rs As New ADODB.Recordset
SQL = "SELECT * FROM tblCustomers
ZSQL = " Stuff "
rs.CursorType = adOpenDynamic
rs.LockType = adLockOptimistic
rs.Open SQL, , , ,adCmdText
Here is where i get lost. If I was updating the record souse from a text box I would do
If rsUpdate.EOF = False Then
rsUpdate.Fields.Item("field1") = Me.txtbox2.Value
rsUpdate.Fields.Item("field2") = Me.txtbox3.Value
rsUpdate.Update
rsUpdate.Close
End If
MsgBox "Record Updated"
Set rsUpdate = Nothing
Set cnn = Nothing
But what do you do if you want to update using a sql statement say ZSQL ?
Any assistance an comments are gratefully welcomed
Dim rs As New ADODB.Recordset
SQL = "SELECT * FROM tblCustomers
ZSQL = " Stuff "
rs.CursorType = adOpenDynamic
rs.LockType = adLockOptimistic
rs.Open SQL, , , ,adCmdText
Here is where i get lost. If I was updating the record souse from a text box I would do
If rsUpdate.EOF = False Then
rsUpdate.Fields.Item("field1") = Me.txtbox2.Value
rsUpdate.Fields.Item("field2") = Me.txtbox3.Value
rsUpdate.Update
rsUpdate.Close
End If
MsgBox "Record Updated"
Set rsUpdate = Nothing
Set cnn = Nothing
But what do you do if you want to update using a sql statement say ZSQL ?
Any assistance an comments are gratefully welcomed