Mega Code Archive

 
Categories / VisualBasic Script / Access
 

Get the updated record count

Sub Execute_UpdateQuery()    Dim conn As ADODB.Connection    Dim NumOfRec As Integer    Dim strPath As String    strPath = CurrentProject.Path & "\mydb.mdb"    Set conn = New ADODB.Connection    conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strPath    conn.Execute "UPDATE Products SET UnitPrice = UnitPrice + 1" & _       " WHERE CategoryId = 8", NumOfRec, adExecuteNoRecords    Debug.Print NumOfRec & " records were updated."    conn.Close    Set conn = Nothing End Sub