Try:
Private Sub Command3_Click()
With CurrentDB
.Execute "update master set tag = true where tag = false"
MsgBox "Total records affected by this operation is [" & .RecordsAffected
& "]"
End With
End Sub
Look into the RecordsAffected Property of a DAO Recordset.
Private Sub Command3_Click()
Dim db As DAO.Database
Dim qd As DAO.Querydef
Dim strSQL As String
On Error GoTo Proc_Error
Set db = CurrentDb
strSQL = "UPDATE Master SET Tag = True WHERE Tag = False;"
Set qd = db.CreateQuerydef("", strSQL)
qd.Execute dbFailOnError
MsgBox qd.RecordsAffected
Set qd = Nothing
Proc_Exit: Exit Sub
Proc_Error:
MsgBox "Error " & Err.Number & ": " & Err.Description
Resume Proc_Exit
End Sub
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.