>
Dim varCreation As Variant, varDesignChange As Variant Dim rstEmployees As Recordset, dbsNorthwind As Database Set dbsNorthwind = DBEngine.Workspaces(0).OpenDatabase("Northwind.mdb") Set rstEmployees = dbsNorthwind.OpenRecordset("Employees", dbOpenTable) varCreation = rstEmployees.DateCreated varDesignChange = rstEmployees.LastUpdatedExample (Microsoft Access) The following example enumerates through all QueryDef objects in the database and lists those which have been created or changed within the last week.
Sub TimeUpdated() Dim dbs As Database, tdf As TableDef, qdf As QueryDef Dim strList As String, intI As Integer Dim dteWeek As Date ' Return Database variable that points to current database. Set dbs = CurrentDb dteWeek = Now - 7 intI = 0 ' Enumerate through QueryDefs collection. For Each qdf In dbs.QueryDefs ' Evaluate LastUpdated and DateCreated properties. If (qdf.LastUpdated > dteWeek) Or (qdf.DateCreated > dteWeek) _ Then ' Create list.
strList = strList & Chr(13) & Chr(10) & qdf.Name End If intI = intI + 1 Next qdf MsgBox strList End SubExample (Microsoft Excel) This example displays the dates and times when the Customer recordset in the NWINDEX.MDB database was created and last updated. To create the NWINDEX.MDB database, run the Microsoft Excel example for the CreateDatabase method.
Dim creation As Variant, changed As Variant Dim db As Database, td As TableDef Set db = Workspaces(0).OpenDatabase(Application.Path & "\NWINDEX.MDB") Set td = db.TableDefs("Customer") creation = td.DateCreated changed = td.LastUpdated MsgBox "The " & td.Name & " table was created on " & creation _ & " and updated on " & changed db.Close