S
Stelvio Gori - DecisionWorks consulting
Hi everyone and thanks in advance for your help.
I'm trying to open and update an Access recordset using ADO, by using the
following code:
************
Public Sub UpdateAutore()
Dim rs As Recordset
Dim strP As String
' utilizzo un blocco non read-only per poter modificare il record
Set rs = New ADODB.Recordset
rs.Open "Prova1", CurrentProject.Connection, adOpenKeyset,
adLockOptimistic
rs.MoveFirst
strP = rs.Fields("Campo1")
' Debug.Print strP
rs.MoveNext
' esegue loop sul recordset
Do Until rs.EOF
If IsNull(rs.Fields("Campo1").Value) = True Then
rs.Edit
rs.Fields("Campo1").Value = strP
' Debug.Print rs.Fields("Campo1")
Else: rs.Edit
strP = rs.Fields("Campo1").Value
End If
rs.MoveNext
Loop
rs.Close
End Sub
************
but I get an error in code line 5 (rs.Open ....): "Impossible to find method
or data member".
I'm trying to use this code reported on a Access Guide: I can open the
recordset when usind DAO but I get the problem when using ADO (as it is in
the code above).
Could you help?
Thanks,
Stelvio
I'm trying to open and update an Access recordset using ADO, by using the
following code:
************
Public Sub UpdateAutore()
Dim rs As Recordset
Dim strP As String
' utilizzo un blocco non read-only per poter modificare il record
Set rs = New ADODB.Recordset
rs.Open "Prova1", CurrentProject.Connection, adOpenKeyset,
adLockOptimistic
rs.MoveFirst
strP = rs.Fields("Campo1")
' Debug.Print strP
rs.MoveNext
' esegue loop sul recordset
Do Until rs.EOF
If IsNull(rs.Fields("Campo1").Value) = True Then
rs.Edit
rs.Fields("Campo1").Value = strP
' Debug.Print rs.Fields("Campo1")
Else: rs.Edit
strP = rs.Fields("Campo1").Value
End If
rs.MoveNext
Loop
rs.Close
End Sub
************
but I get an error in code line 5 (rs.Open ....): "Impossible to find method
or data member".
I'm trying to use this code reported on a Access Guide: I can open the
recordset when usind DAO but I get the problem when using ADO (as it is in
the code above).
Could you help?
Thanks,
Stelvio