Objects Properties Access 2003

Local time
Today, 00:30
Joined
Apr 29, 2001
Messages
47
I want to be able to create a table that contains all the database objects by name, created date and modify date...

is there a way of doing this... or is there another way to achieve what I am trying to do...

I have tried to use the following code my it does not pick up all objects or names...

<<<<<Code Start>>>>>
Function DisplayContainers(strDatabase As String, intCollection As Integer) As Integer

Dim DefaultWorkspace As Workspace
Dim CurrentDatabase As Database
Dim MyContainer As Container
Dim MyDocument As Document
Dim rst As Recordset
Dim i As Integer
Dim j As Integer
Set DefaultWorkspace = DBEngine.Workspaces(0)
If strDatabase = "" Then
Set CurrentDatabase = DefaultWorkspace.Databases(0)
Else
Set CurrentDatabase = DefaultWorkspace.OpenDatabase(strDatabase)
End If

If intCollection = -1 Then
For j = 0 To CurrentDatabase.Containers.Count - 1
Set MyContainer = CurrentDatabase.Containers(j)
Next j
Else
Set MyContainer = CurrentDatabase.Containers(intCollection)
For i = 0 To MyContainer.Documents.Count - 1
Set rst = CurrentDatabase.OpenRecordset("tlkpMasterContainers", dbOpenDynaset)
Set MyDocument = MyContainer.Documents(i)
With rst
.AddNew
!itemName = MyDocument.Name
!itemDateCreate = MyDocument.DateCreated
!itemDateModify = MyDocument.LastUpdated
.Update
End With
Next i
End If
If strDatabase <> "" Then
CurrentDatabase.Close
Set CurrentDatabase = Nothing
End If
DisplayContainers = True
End Function

<<<<<code ends>>>>>
 
Instead of reinventing the wheel, why not use MSysObjects table which already has all that information and you can even query that table. (Of course, be *careful* to not write anything to MSysObjects. While it will block writes, you do want to make sure the query is read-only (e.g. use snapshot).

Here's something to get you started.
 

Users who are viewing this thread

Back
Top Bottom