|
|
Кол-во обработанных записей (DAO)
Пример эксплуотоции:
Private Sub Command00_Click()
Dim l&, s$
s = "UPDATE Таблица1 SET Наим1 = '" & Nz(Me!П1, "") & "', " & _
"Поле2 = '" & Nz(Me!П2, "") & "', Поле3 = '" & Nz(Me!П3, "") & "' " & _
"WHERE Код=" & Nz(Me!Код, 0)
l = QueryRecordsAffectedDAO(s)
If l > 0 Then
MsgBox "Обновлено: " & l & " записей.", vbInformation
Else
MsgBox "Записи не обновлены!", vbExclamation
End If
End Sub
Public Function QueryRecordsAffectedDAO(qNameOrSQLSring As String) As Long
Dim db As DAO.Database
On Error GoTo QueryRecordsAffected_Err
Set db = CurrentDb
db.Execute qNameOrSQLSring, dbFailOnError
QueryRecordsAffectedDAO = db.RecordsAffected
QueryRecordsAffected_End:
On Error Resume Next
Set db = Nothing
Err.Clear
Exit Function
QueryRecordsAffected_Err:
MsgBox "Error: " & Err.Number & vbCrLf & Err.Description & vbCrLf & _
"in Function: QueryRecordsAffected in module: []", vbCritical, "Error in Application"
Resume QueryRecordsAffected_End
End Function
|
|