Solved

Dates objects are created or mofified...

Posted on 2014-03-25
4
133 Views
Last Modified: 2014-04-11
I need a routine to run in an access database to list objects created along with their created and modified dates.

Question: Do you have a routine like this or can you put together if not very involved?

Thank you.
0
Comment
Question by:Mike Eghtebas
  • 2
4 Comments
 
LVL 45

Expert Comment

by:aikimark
ID: 39954544
If you just need that information about tables and queries, you can use this:
Public Sub IterateTablesAndQueries()
    Dim td As TableDef
    Dim qd As QueryDef
    For Each td In DBEngine(0)(0).TableDefs
        Debug.Print td.Name, td.DateCreated, td.LastUpdated
    Next
    For Each qd In DBEngine(0)(0).QueryDefs
        Debug.Print qd.Name, qd.DateCreated, qd.LastUpdated
    Next
End Sub

Open in new window

0
 
LVL 45

Accepted Solution

by:
aikimark earned 250 total points
ID: 39954575
This will pick up tables, queries, forms, and reports
Public Sub IterateAllObjects()
    Dim rs As Recordset
    Set rs = DBEngine(0)(0).OpenRecordset("Select name, DateCreate, DateUpdate from msysobjects where flags=0 and type in (1,5,-32768,-32764)")
    Do Until rs.EOF
        Debug.Print rs!Name, rs!datecreate, rs!dateupdate
        rs.MoveNext
    Loop
End Sub

Open in new window

Note: You will get the system tables if you remove the flags=0 condition in the Where clause.
0
 
LVL 47

Assisted Solution

by:Dale Fye (Access MVP)
Dale Fye (Access MVP) earned 150 total points
ID: 39954587
which objects?  You can use something like:

SELECT [TYPE],[Name], [Owner], DateCreated, DateUpdated
FROM mSysObjects

But that will give you all objects.  To get more specific, you would need to use the [Type] field to restrict that to the specific types of objects.

Tables: 1 (local), 6 (Linked)
Forms: -32768
Reports: -32764
Queries: 5
Modules: -32761
0
 
LVL 36

Assisted Solution

by:PatHartman
PatHartman earned 100 total points
ID: 39954626
There is no reliable method since Access changes the create and modified dates of some objects whenever you compact.  The create date usually survives but who among us has never had to rebuild a database due to corruption - there goes your create dates.

Do some testing so you understand when Access will change these dates on you.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question