Hi,
I want to develop a script to audit the last time a Microsoft Access table was modified/updated, and I got the following code, but I receive an error in line "MsgBox LastTime", that says "Microsoft VBScript runtime error:94, Invalid use of Null: 'LastTime'". This is the code:
-----------------------------------------------
VBStart
Sub LastTimeModified
'This is VBScript code
Set Cat = CreateObject("ADOX.Catalog")
'The ODBC Connection is called Transmissions
Cat.ActiveConnection = "Transmissions"
'I want to know the last time table TransFor was modified
LastTime = Cat.Tables("TransFor").DateModified
MsgBox LastTime
Set Cat = Nothing
End Sub
VBEnd
VBRun>LastTimeModified
---------------------------------------------
How can I fix my code to get the last time a table was modified?
Thanks,
Salvador Hernandez
How can I get the last time a MS-Access table was modified?
Moderators: Dorian (MJT support), JRL
How can I get the last time a MS-Access table was modified?
Thanks,
Salvador Hernandez
Salvador Hernandez
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
It looks like a sub routine vs. a function that will return a value.
Think you need to make it a function, something like this (untested):
Think you need to make it a function, something like this (untested):
VBSTART
Function LastTimeModified()
'This is VBScript code
Set Cat = CreateObject("ADOX.Catalog")
'The ODBC Connection is called Transmissions
Cat.ActiveConnection = "Transmissions"
'I want to know the last time table TransFor was modified
LastTime = Cat.Tables("TransFor").DateModified
MsgBox LastTime
Set Cat = Nothing
End Function
VBEnd
VBEval>LastTimeModified,LastTime
MessageModal>%LastTime%
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!