Modified date of Table in external database

  • Thread starter Thread starter Babsie
  • Start date Start date
B

Babsie

Hello,

I am using the following code in a text box on my form (found on this
discussion group)

=Application.CurrentDB.TableDefs("Insert Table
Name").DateCreated

What I'm also trying to do is have a text box show the last update date on a
table in a different database. I attempted to do the same as shown above but
change the "CurrentDB" to the path and name of the database but I receive a
#name? error.

Any thoughts on how to do this? if it's even possible.

Thanks in advance.
 
Hello,

I am using the following code in a text box on my form (found on this
discussion group)

=Application.CurrentDB.TableDefs("Insert Table
Name").DateCreated

What I'm also trying to do is have a text box show the last update date on a
table in a different database. I attempted to do the same as shown above but
change the "CurrentDB" to the path and name of the database but I receive a
#name? error.

Any thoughts on how to do this? if it's even possible.

Thanks in advance.

Copy and paste the below code into module.
Enter the correct path, database name, and table name where indicated.

Public Function GetDateCreated()
Dim wrkJet As Workspace
Dim Db As DAO.Database
Dim tdf As TableDef
Dim tbl As Table
Dim strList As String
Set wrkJet = CreateWorkspace("", "admin", "", dbUseJet)
Set Db = wrkJet.OpenDatabase("c:\MyFolder\DbName.mdb", , False)
Set tdf = Db.TableDefs("TableName")
GetDateCreated = tdf.DateCreated
Db.Close
Set Db = Nothing
wrkJet.Close
Set wrkJet = Nothing
End Function
 
Copy and paste the below code into module.
Enter the correct path, database name, and table name where indicated.

Public Function GetDateCreated()
Dim wrkJet As Workspace
Dim Db As DAO.Database
Dim tdf As TableDef
Dim tbl As Table
Dim strList As String
Set wrkJet = CreateWorkspace("", "admin", "", dbUseJet)
Set Db = wrkJet.OpenDatabase("c:\MyFolder\DbName.mdb", , False)
Set tdf = Db.TableDefs("TableName")
GetDateCreated = tdf.DateCreated
Db.Close
Set Db = Nothing
wrkJet.Close
Set wrkJet = Nothing
End Function

Oops...
No need to Dim strList nor tbl in the above code.
Simply a holdover from previously used code.
 
Back
Top