If you want to know the last time any record in the table was added,
modified, or deleted, there is no property that gives that information.
The best you can do in that regard is either maintain a "LastModified"
date/time field in the table (but that doesn't help with deletions), or
else only allow the table to be updated by procedures that record audit
information in another table.
If instead you want to know when the table's *design* was last modified,
you can get that from a property of the DAO TableDef object; e.g.,
Dim db As DAO.Database
Set db = CurrentDb
Debug.Print db.TableDefs("Table1").LastUpdated
Set db = Nothing
I tried your idea with the following code, but it did not work:
-----------------------------------------
'This is VBScript code
Set MyDB = CreateObject("ADODB.Connection")
'The ODBC Connection is called Transmisions
MyDB.Open "Transmisions"
'I want to know the last time table TransFor was modified
LastTime = MyDB.Table("TransFor").LastModified
MsgBox(LastTime)
MyDB.Close
I tried your idea with the following code, but it did not work:
-----------------------------------------
'This is VBScript code
Set MyDB = CreateObject("ADODB.Connection")
'The ODBC Connection is called Transmisions
MyDB.Open "Transmisions"
'I want to know the last time table TransFor was modified
LastTime = MyDB.Table("TransFor").LastModified
MsgBox(LastTime)
MyDB.Close
As far as I know, the ADO Connectin object doesn't have a Table
collection. For this you'd need to use ADOX, and the Tables collection
of a Catalog object. Something like this:
Set cat = CreateObject("ADOX.Catalog")
cat.ActiveConnection = "Transmissions"
LastTime = cat.Tables("TransFor").DateModified
MsgBox LastTime
Set cat = Nothing
But I'm not really all that conversant with ADO and ADOX, so that may
not be exactly right.
Thanks for your help, I get an error message like this "Microsoft VBScript runtime error: 94, Invalid use of Null:'LastTime'", and this happens in the line with the instruction "MsgBox LastTime".
Thanks for your help, I get an error message like this "Microsoft
VBScript runtime error: 94, Invalid use of Null:'LastTime'", and this
happens in the line with the instruction "MsgBox LastTime".
I don't know what "Transmissions" is, in your code and configuration.
This works for me, to get the last-modifed date of a table named
"Table1" in a test .mdb file:
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.