Obtain Table Created Date in VBA

I

Inquisitive1

Is there a way to store the created date for a table in a variable? I
searched through the postings and the closest thing that I found was
Currentproject.AllForms("frmYourFormHere").DateModified. I tried to
use the currentproject., but that had everything except tables.

I am still dabbling with VBA, so please let me know if I need to be
more specific.

Thanks!
 
B

Brendan Reynolds

CurrentData is the object that contains the tables ...

Public Sub ListTables()

Dim aob As AccessObject
For Each aob In CurrentData.AllTables
If Left$(aob.Name, 4) <> "MSys" Then
Debug.Print aob.Name, aob.DateCreated
End If
Next aob

End Sub
 
I

Inquisitive1

That doesn't seem to work. I manipulated your code at first, and got
an error. So, I brought your entire code in and tried to run it, but I
got the following error: Run-time error '438': Object doesn't support
this property.

Any suggestions?
 
I

Inquisitive1

I think ADP must mean a front end? Yes, I am using Access 2000. I
forgot to write that in my first thread.
 
B

Brendan Reynolds

No, in Access 2000 and later you can create two types of Access file, MDB or
ADP. If you're not sure which you have, you can find out by pressing Ctrl+G
to go to the Immediate Window, typing ? CurrentProject.ProjectType and
pressing enter. If the result displayed in the Immediate window is 1, you're
using an ADP, if it is 2, you're using an MDB. The code I posted will work
in an MDB, but apparently not in an ADP. In an ADP, the following SQL will
list user tables and their created date ...

SELECT name, crdate
FROM dbo.sysobjects
WHERE (xtype = 'u')
 
I

Inquisitive1

Okay. I checked and found that I am using an MDB (2 was returned from
the immediate window). I stepped into the code and it doesn't like the
line "Debug.Print aob.Name, aob.DateCreated". I hovered my mouse over
aob.Name and I can see the table name. When I hover my mouse over
aob.DateCreated, nothing appears. So, I am assuming that there is a
problem with the aob.DateCreated. Do I need to add a specific
reference for this to work?

Thanks for your help!
 
B

Brendan Reynolds

I'm afraid it is a mystery to me why the code would not work for you. But
then I am using Access 2003. I'm at home now, and don't have access to a PC
with Access 2000 installed - I'll try to test on Access 2000 when I get back
to the office tomorrow.
 
Top