Deleting Records via ADO

Like updating a record, the key is being able to write a bit of SQL to uniquely identify the record(s) to be deleted. The following code uses the Execute method to pass the Delete command through to Access:

Public Sub ADOWipeOutAttribute(RecID)

1 Establish a connection transfers.mdb MyConn = "J:\transfers.mdb"

With New ADODB.Connection

.Provider = "Microsoft.Jet.OLEDB.4.0" .Open MyConn

.Execute "Delete From tblTransfer Where ID = " & RecID .Close End With End Sub

0 0

Post a comment