31/03/2020, 20:32
Sub LastModifiedX()
Dim dbsNorthwind As Database
Dim rstEmployees As Recordset
Dim strFirst As String
Dim strLast As String
Set dbsNorthwind = OpenDatabase("Northwind.mdb")
Set rstEmployees = _
dbsNorthwind.OpenRecordset("Employees", _
dbOpenDynaset)
With rstEmployees
' Store current data.
strFirst = !FirstName
strLast = !LastName
' Change data in current record.
.Edit
!FirstName = "Julie"
!LastName = "Warren"
.Update
' Move current record pointer to the most recently
' changed or added record.
.Bookmark = .LastModified
Debug.Print _
"Data in LastModified record after Edit: " & _
!FirstName & " " & !LastName
' Restore original data because this is a demonstration.
.Edit
!FirstName = strFirst
!LastName = strLast
.Update
' Add new record.
.AddNew
!FirstName = "Roger"
!LastName = "Harui"
.Update
' Move current record pointer to the most recently
' changed or added record.
.Bookmark = .LastModified
Debug.Print _
"Data in LastModified record after AddNew: " & _
!FirstName & " " & !LastName
' Delete new record because this is a demonstration.
.Delete
.Close
End With
dbsNorthwind.Close
End Sub
Bu örnek, geçerli kayıt işaretçisini değiştirilmiş bir kayda ve yeni oluşturulan bir kayda taşımak için LastModified özelliğini kullanır.