Manuel Cavero
New Member
- Joined
- Feb 17, 2018
- Messages
- 26
Hello everyone:
I'm trying to delete all records in a RecordSet ADODB Object connected to a Excel Sheet, using two differents ways:
Also, as far as I know MS recommend to use the 2nd
So, what I'm trying to do is:
What I'm trying with this code, it's delete all records from the table FTE, but no one is deleted....
Thanks a lot and have a nice day!
I'm trying to delete all records in a RecordSet ADODB Object connected to a Excel Sheet, using two differents ways:
- Delete records using an ADODB Connection Object
- Delete records using an ADODB RecordSet Object
Also, as far as I know MS recommend to use the 2nd
So, what I'm trying to do is:
Code:
Dim Conn as string
Dim RS as adodb.Recordset
Conn = _[INDENT]"Provider=Microsoft.ACE.OLEDB.12.0;" & _[/INDENT]
[INDENT]"Data Source= " & Path & ";" &
"Extended Properties=Excel 12.0;"
[/INDENT]
Set RS = New adodb.RecordSet
With RS
.ActiveConnection = Conn
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Source = "SELECT * FROM [FTE$]"
.Open
Set .ActiveConnection = Nothing
.Delete 1
.ActiveConnection = Conn
.Update
.Close
End with
What I'm trying with this code, it's delete all records from the table FTE, but no one is deleted....
Thanks a lot and have a nice day!