Shouldn't we move away from using COM?
here a simple function that Updates a record in Access,
You can alter the function to Insert Into or Delete records.
Private Function SetTableValue(ByVal nID As Integer, ByVal sField As String, ByVal nValue As Integer, ByVal sTable As String) As Integer
Dim SqlCMD As OleDbCommand
Dim SqlCN As New OleDbConnection(Conn)
Dim recordsAffected As Integer, strSql As String
Try
strSql = "UPDATE " & sTable & " SET " & sField & " = " & nValue & " WHERE ID = " & nID
If SqlCN.State = ConnectionState.Closed Then SqlCN.Open()
SqlCMD = New OleDbCommand(strSql, SqlCN)
recordsAffected = SqlCMD.ExecuteNonQuery()
Catch
recordsAffected = -1
Finally
If SqlCN.State = ConnectionState.Open Then SqlCN.Close()
If Not SqlCMD Is Nothing Then SqlCMD.Dispose()
End Try
Return recordsAffected
End Function