All; Using Access 2010. I have the following code to add the current date to the current table when a new table with the same name is imported. The code is fine except now I need the date the current table was created instead the current date added. Ex. Current table name tblCur when the new tblCur is imported; the current tbl becomes tblCur05112015 but it was created on 05052015. How can I get the date the table was created which is the table property date?
Code:
'Open backend and add date to tblCur to allow for import of current data
Dim dbBackend As DAO.Database
Dim strBackendDatabase As String
Dim tdf As DAO.TableDef
strBackendDatabase = "C:\ProjectsaccdbCurFiles.accdb"
Set dbBackend = OpenDatabase(strBackendDatabase)
For Each tdf In dbBackend.TableDefs
If tdf.Name = "tblCur" & Format(Date, "yyyymmdd") Then Exit For
Next tdf
If tdf Is Nothing Then
dbBackend.TableDefs("tblCur").Name = " tblCur " & Format(Date, "yyyymmdd")
dbBackend.Close
Else
' The archive table already exists: Take action (Rename, Delete, Warns...)
End If