RecordsAffected Property Example (MDB)
The following example prints the number of records updated by an action query:
Sub RecordsUpdated()
Dim dbs As Database, qdf As QueryDef
Dim strSQL As String
' Return reference to current database.
Set dbs = CurrentDb
strSQL = "UPDATE Employees SET Title = " _
& "'Senior Sales Representative' " _
& "WHERE Title = 'Sales Representative';"
' Create new QueryDef object.
Set qdf = dbs.CreateQueryDef("UpdateTitles", strSQL)
' Execute QueryDef object.
qdf.Execute
Debug.Print qdf.RecordsAffected
Set dbs = Nothing
End Sub