Advertisement

04.27.2008 at 05:07PM PDT, ID: 23357524
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

For Experts: Exploring the DAO object model

Tags: Microsoft, Access
Hello experts,

This is not a question, but rather a open thread for technical discussion about DAO. However, there is a challenge for the points.

Apparently, there are four documents in the Databases container.
- Why four? what are they? can I use them?
[Questions originally from DabaseMX; I didn't and still don't have the answers...]

DAO is a hot topic; quoted from a young promising MVP:

"Just to be definite on this point for readers... DAO really is very much MS' data access API of choice these days (again!)"

Cheers all!

Markus
(°v°)
1:
2:
3:
4:
5:
For Each d in DBEngine(0)(0).Containers!Databases.Documents:?d.Name:next
AccessLayout
MSysDb
SummaryInfo
UserDefined
Start your free trial to view this solution
Question Stats
Zone: Microsoft
Question Asked By: harfang
Solution Provided By: GRayL
Participating Experts: 6
Solution Grade: A
Views: 43
Translate:
Loading Advertisement...
04.27.2008 at 05:17PM PDT, ID: 21450862

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.27.2008 at 06:44PM PDT, ID: 21451088

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.27.2008 at 07:34PM PDT, ID: 21451258

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.27.2008 at 08:14PM PDT, ID: 21451384

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.28.2008 at 04:57AM PDT, ID: 21453094

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.28.2008 at 06:31AM PDT, ID: 21453743

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.28.2008 at 06:55AM PDT, ID: 21453982

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.28.2008 at 08:32AM PDT, ID: 21454945

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.28.2008 at 09:25AM PDT, ID: 21455388

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.28.2008 at 09:50AM PDT, ID: 21455549

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.28.2008 at 11:04AM PDT, ID: 21456112

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.28.2008 at 11:28AM PDT, ID: 21456360

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.28.2008 at 07:56PM PDT, ID: 21459327

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.28.2008 at 08:33PM PDT, ID: 21459475

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.30.2008 at 08:08PM PDT, ID: 21476304

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.30.2008 at 10:10PM PDT, ID: 21476619

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.01.2008 at 12:39AM PDT, ID: 21477002

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.01.2008 at 05:37AM PDT, ID: 21478014

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.01.2008 at 08:43AM PDT, ID: 21479710

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.01.2008 at 10:29AM PDT, ID: 21480702

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.01.2008 at 10:54AM PDT, ID: 21480893

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.01.2008 at 01:08PM PDT, ID: 21482217

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.06.2008 at 06:08PM PDT, ID: 21512410

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.06.2008 at 06:13PM PDT, ID: 21512428

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
04.27.2008 at 05:17PM PDT, ID: 21450862
The description of the "related solution" was meant to be "previous thread in the experts series"; it didn't "take".

This is also a follow-up to:
Error 3420: Object invalid or no longer set. -- http:/Q_23355139.html

In that thread, Containers were compared to TableDef objects in that both need a "live" parent Database object to function. I was going to argue that Containers cannot be passed directly to Jet, because there is more to it then simple lookups into the system tables. I came upon the bizarre and totally virtual "database object" called "User Defined": it doesn't contain anything, does it?

(°v°)
 
04.27.2008 at 06:44PM PDT, ID: 21451088

Rank: Genius

I'm running A2k3 on XP Home.  With this code in the Immediate Pane:

 set ctrs=currentdb.Containers
? ctrs("Databases").Documents.Count
 4
set docs=ctrs("Databases").Documents
for each doc in docs:? doc.name:Next doc
AccessLayout
MSysDb
SummaryInfo
UserDefined

Just so were on the same page - documents - not - containers - right?
Accepted Solution
 
04.27.2008 at 07:34PM PDT, ID: 21451258
Wow.

You are right: you can disconnect the Containers collection from the Database object. This is very interesting! I immediately tried with an individual Container, the Documents collection and an individual Document:

set x = currentdb.containers: ? x.count   ' -- only this works!
set x = currentdb.containers!databases: ? x.name
set x = currentdb.containers!databases.documents: ? x.count
set x = currentdb.containers!databases.documents!MSysDb: ? x.name

Still, the entire tree is available if you persist either the Database object (obviously) or only the Containers collection (your ctrs variable). So Leigh was right in guessing that Container objects and Document objects do not use any Database methods.

Thanks for finding that!

(°v°)
 
04.27.2008 at 08:14PM PDT, ID: 21451384
This has been turning in the back of my head until I thought of:

set tdfs = currentdb.TableDefs
set tdf = tbls!Table1
? tdf.Fields.Count

Following my previous logic, I now have to assume that top level collections of the Database object persist their parent. This is easily tested (see below), so our previous conclusions hold.

(°v°)
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
Sub TestHyp()
    Dim tdf, tdfs
    With CurrentDb
        Set tdf = .TableDefs!Table1
        ' Set tdfs = .TableDefs   ' uncomment this
    End With
    Debug.Print tdf.Fields.Count  ' and this works
    Set tdfs = Nothing
    Debug.Print tdf.Fields.Count  ' but not anymore
End Sub
Open in New Window
 
04.28.2008 at 04:57AM PDT, ID: 21453094

Rank: Genius

The Containers collection within DAO is used by JET and other applications as a means of implementing security on objects.  Some containers are JET based, others are Access based.  Containers are built into the product (JET and Access), so you cannot create new containers nor can you delete them.

  Containers contain documents.  Each document represents an object.   About the only thing you can do with documents is set security.  It has only a half dozen or so properties and they all relate to security.

  I've attached code to display all containers for a given database, the documents they contain, and the owner property for each document.

JimD
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
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 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)
            Debug.Print ">> Container: "; j; " "; MyContainer.Name;
            Debug.Print ""
        Next j
    Else
        Set MyContainer = CurrentDatabase.Containers(intCollection)
        For i = 0 To MyContainer.Documents.Count - 1
            Set MyDocument = MyContainer.Documents(i)
            Debug.Print " > Document: "; MyDocument.Name;
            Debug.Print ""
            Debug.Print " > Owner: "; MyDocument.Owner;
            Debug.Print ""
        Next i
    End If
 
    If strDatabase <> "" Then
        CurrentDatabase.Close
        Set CurrentDatabase = Nothing
    End If
    
    DisplayContainers = True
 
 
End Function
Open in New Window
Assisted Solution
 
04.28.2008 at 06:31AM PDT, ID: 21453743

Rank: Genius

Sorry to be late Markus - still very busy catching up.
(I was pushing it posting as much as I did in the previous thread too!)

I'd go so far as to say Containers have a bit more to offer than Security alone.
They're a pretty fundamental object in DAO.  Functionality wise - sure as I mentioned earlier - they're fixed objects, we can't append to their documents collection or create new ones.  
But they do offer the fundamental collections of the database (yes, which can be effectively emulated through reading mSysObjects too).

Jim did mention the relevancy of Properties in the Documents though.
One example of where their properties (often not thought of as such a fundamental issue when we're thinking of security and database schemas) are important:
Markus mentioned somewhere earlier about the "UserDefined" document in the "Databases" container.
It's the only way that I'm aware of for programmatically specifying and retrieving the Database's custom properties.
By way of example through the UI:
File > Database Properties > Custom
Create a new custom property "YourCustomPropName", set a value and add it.
CurrentDb.Containers("Databases").Documents("UserDefined").Properties("YourCustomPropName")
retrieves it.

And, naturally, code like
    Dim cdc As DAO.Document
   
    With CurrentDb
        Set cdc = .Containers("Databases").Documents("UserDefined")
        cdc.Properties.Append cdc.CreateProperty("YourNextProp", dbText, "Hello Again!")
    End With
creates them.

The analogous user defined Custom properties in, say, a Word document are fairly trivially available in the CustomDocumentProperties collection (I dunno - where do they think up these names :-).
But you know - we like things a bit more obscure in Access.
The Containers (and their documents) are far from comprehensive - but they're a decent stab at a holistic database object overview.  (Which is why security gravitates so well towards it).
Given that ULS has gone from Acc2007 - I wonder if we'll see a change in the Containers functionality within Access' OM in the future.  

I too find it interesting that the collections will persist the database object - but no children therin do so.
The old "one sub-level only" or a real platform decision I wonder. (i.e. that the collection infers parent ownership/persistance).
I'd still like to have seen *methods* fail rather than entire objects drop out.
Hey ho...

btw... "a young promising MVP"?  Thanks!
Young?  Hmmm...
Promising?  Well I make a good few promises lol.
Assisted Solution
 
04.28.2008 at 06:55AM PDT, ID: 21453982

Rank: Genius


  I guess I wasn't too clear when I said:

"  About the only thing you can do with documents is set security. "

  What I meant was the document object itself, not the object it represents.  For example, when you gave this example:

CurrentDb.Containers("Databases").Documents("UserDefined").Properties("YourCustomPropName")

   Your setting the property of the UserDefined object itself and not a property of document object that holds that object.  Properties in this case is a collection that belongs to the Documents Object.  It doesn't represent the properties of the document object, which are:

AllPermissions
Contrainer
DateCreated
KeepLocal
LastUpdated
Name
Owner
Permissions
Replicable
UserName

  while some of those might be useful (DateCreated, LasUpdated), most deal with security, which is why I said that that really it's about the only thing you can do with a document.

JimD

Assisted Solution
 
04.28.2008 at 08:32AM PDT, ID: 21454945

Rank: Genius

Subscribed to learn something new :-)

This following code lists Document properties.  In the SummaryInfo document, you can also get or set information such as database Title, Author and Company.

> It's the only way that I'm aware of for programmatically specifying and retrieving the Database's custom properties.

What becomes of properties created like this (what is the difference?):
    Set prp = CurrentDb.CreateProperty(PropName, PropType, PropValue)
    CurrentDb.Properties.Append prp

I created a property using that code and then ran:
    Set d = DBEngine(0)(0).Containers("Databases").Documents("UserDefined")
    Debug.Print d.Properties.Count

The printed count remained unchanged.  Is that not a "Custom Property"?
1:
2:
3:
4:
5:
6:
7:
8:
9:
    Dim prp
    Dim d As Document
        For Each d In DBEngine(0)(0).Containers!Databases.Documents
            Debug.Print "--" & d.Name & "--"
            For Each prp In d.Properties
                Debug.Print prp.Name
            Next
            Debug.Print vbCrLf & vbCrLf
        Next
Open in New Window
Assisted Solution
 
04.28.2008 at 09:25AM PDT, ID: 21455388

Rank: Genius

> what is the difference?

Or why would you choose one of these methods for creating custom properties over the other?
 
04.28.2008 at 09:50AM PDT, ID: 21455549
Miriam,

You can add properties to all DAO objects, including the root database object. However, the "Database" document "UserDefined" in the Access implementation of the document properties all Office documents now possess: (File | Properties), [Custom] tab.

ACC: Using DAO to Set and Retrieve Custom Database Properties
http://support.microsoft.com/kb/178745

Also, if you use DBEngine(0)(0) [...] Properties, you need to refresh the collection. This is the main reason CurrentDb is recommended instead. It makes no difference for Containers (it's a fixed list), but it's essential for all other collections within the database object tree. That was the topic of the thread that prompted this one (see the first comment)...

[More later, got to run]

(°v°)
 
04.28.2008 at 11:04AM PDT, ID: 21456112

Rank: Genius

Sorry I've been MIA on this thread - since indirectly started it, but hope I can chime in soon. I'm involved in a major beta test of a new database right now - which is a bit time consuming.

mx
 
04.28.2008 at 11:28AM PDT, ID: 21456360

Rank: Genius

Just to speak briefly on the question of:
"why would you choose one of these methods for creating custom properties over the other"

It's a question of requirements or even preference.
The UI interface for the genuine Custom properties might be advantageous to some.
I feel it has more of a place in applications such as in Word documents (the data merge technique using Document property fields is a perfectly reasonable method and the UI for exposing the properties used offers a transparent insight for the users to this process).

Alternatively, any User-Defined Database properties created are exposed primarily within the OM (obviously the Application properties are the exception where Access has created User-Defined properties and exposes them in the database window and so forth - "Description" being the classic example) - but their readily accessible and specified nature makes them better candidates for everyday grind IMO.
It can even come down to being as simple as hierarchy level. Which of the two is right there as a property of the parent db.
And of course - the developer may *want* to keep certain properties obscured from prying eyes ;-)
Assisted Solution
 
04.28.2008 at 07:56PM PDT, ID: 21459327
@JDettman

Yes, you are quite right: almost all containers and all user documents are exposed in the (Tools | Security | User and Group Permissions...). The containers are named <new something>, and serve mainly as template for the permissions of new objects. (I also tend to believe that the Database Window uses the DAO Documents directly to present the lists of objects, and not, say, the Project's AllXXX collections.)

However, when selecting "Database", the container is presented as <Current Database>, and the four items under scrutiny are not revealed. A quick check of the Permissions defined for them reveals nothing terribly exciting (see below a list of the -- 20 bit -- security constants and the AllPermissions property of the Database Documents).

Also, removing security flags does not affect the properties of the objects: you can still manipulate them freely. This is not a way to "lock" the custom properties, for example.

I'm guessing that your are correct: the Containers and Documents is meant primarily to allow the manipulation of Access objects, including security and other "external" properties like the description.

    Side note:
    It used to manage creation and modification dates, but the
    introduction of ADO has broken that:
    ACC2000: DAO LastUpdated Property Returns Incorrect Date/Time
    http://support.microsoft.com/kb/299554

In conclusion, if the objects AccessLayout, MSysDb, SummaryInfo, and UserDefined are not there for security, this is probably the wrong path. What are they used for?

(°v°)
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
' dbSecDBCreate      0 ---- ---- ---- ---- ---1 : &H1
' dbSecDBOpen        0 ---- ---- ---- ---- --1- : &H2
' dbSecDBExclusive   0 ---- ---- ---- ---- -1-- : &H4
' dbSecDBAdmin       0 ---- ---- ---- ---- 1--- : &H8
' dbSecNoAccess      0 ---- ---- ---- ---- ---- : &H0
' dbSecCreate        0 ---- ---- ---- ---- ---1 : &H1
' dbSecReadDef       0 ---- ---- ---- ---- -1-- : &H4
' dbSecRetrieveData  0 ---- ---- ---- ---1 -1-- : &H20
' dbSecInsertData    0 ---- ---- ---- --1- ---- : &H32
' dbSecReplaceData   0 ---- ---- ---- -1-- ---- : &H64
' dbSecDeleteData    0 ---- ---- ---- 1--- ---- : &H128
' dbSecDelete        0 ---1 ---- ---- ---- ---- : &H65536
' dbSecWriteDef      0 ---1 ---- ---- ---- 11-- : &H65548
' dbSecReadSec       0 --1- ---- ---- ---- ---- : &H131072
' dbSecWriteSec      0 -1-- ---- ---- ---- ---- : &H262144
' dbSecWriteOwner    0 1--- ---- ---- ---- ---- : &H524288
' dbSecFullAccess    0 1111 1111 1111 1111 1111 : &H1048575
 
' AccessLayout       0 ---- ---- ---- ---- ---- : &H0
' MSysDb             0 -11- ---- ---- ---- 111- : &H393230
' SummaryInfo        0 ---1 ---- ---- ---- ---- : &H65536
' UserDefined        0 ---1 ---- ---- ---- ---- : &H65536
Open in New Window
 
04.28.2008 at 08:33PM PDT, ID: 21459475
The second avenue is Properties.

@Leigh: You seem to think that UserDefined is a pure properties "holder" (I was going to write: properties container, but in this context it's not too sharp). I think so too, and since we don't know of any other practical use of the object, it's a sound empirical conclusion.

@Jim: In your comment http:#a21453982, you try to make a distinction between the "document object" and the "actual object it represents". I prefer to distinguish "external" and "internal" properties.

For example:

    ? CurrentDb.Containers!Forms!Form1.Properties!Description
    My very first form!
    ? Forms!Form1.Properties!Description ' error!
    ? Forms!Form1.Properties!RecordSource
    Table1

So "Description" is an "external" property, or of the Document object, while RecordSource is "internal" and is available only from an instanciated object.

Then of course, there are Custom and Built-in properties. (The second line raises "Cannot delete a built-in property".)

    CurrentDb.Containers!Forms!Form1.Properties.Delete "Description"
    CurrentDb.Containers!Forms!Form1.Properties.Delete "LastUpdated"


Anyway. Are all the four objects used only as property "holders"?

(°v°)
 
04.30.2008 at 08:08PM PDT, ID: 21476304
Well, I guess that my last position holds. This thread has stalled, so I went a bit further and did some software archaeology (it's a new discipline) to gain some insights into the ancient history of Access development.

The snippet below lists all database properties: CurrentDb, Databases Container, and all Documents therein. For Documents, the first eight are skipped; they are totally (well, mostly) uninteresting.

We already know that the Databases *Container* holds information about security, and nothing more.

Trivia: Some settings are only meaningful for Workgroup Information Files (mdw).

    PermissionEnum Enumeration
    http://msdn.microsoft.com/en-us/library/bb242668.aspx

    ACC2000: How to Prevent Users from Creating New Databases
    http://support.microsoft.com/kb/210329

The security settings of the Documents, however, are random, and have no effect {http:#a21459327}. They provide some archaeological insight, however, in that they indicate three different groups, different times, probably different programmers.

MSysDb
¯¯¯¯¯¯¯
The properties of MSysDb are clearly a subset of CurrentDb's. In fact, a little experimenting shows that they are not copies: a property added to MSysDb becomes part of CurrentDb's. There are about a dozen properties belonging only to CurrentDb, but essentially MSysDb *is* the holder of the database's DAO properties. Adding a property to MSysDb adds it also to CurrentDb. Note that some properties are managed in (Tools | Options), but not all.

[This answers more precisely Miriam's question http:#a21454945]

Globally, some properties are relatively recent, e.g. "ANSI Query Mode" or "Themed Form Controls". It would be interesting to examine an Access 97 database. There is very little reason to mess with those, except to obfuscate code.

    ? Application.GetOption("Auto Compact")
    ? CurrentDb.Properties![Auto Compact]
    ? CurrentDb.Containers!Databases.Documents!MSysDb.Properties![Auto Compact]

Trivia:
* Deleting the property "AccessVersion" prevents the database from opening and displays a scary error message ("You misbehaved badly. Loose all hope of retrieving your database objects." -- from memory). Setting the property back fixes it.
* Setting "HasCustomGroups" to False effectively deletes them...

AccessLayout
¯¯¯¯¯¯¯¯¯¯¯¯
A single property in my case: KeepLocal, with value T or V. It's related to replication, so it could be older than MSysDb. Given the name, it's unlikely that more properties are added in a master or replica.

    Changes made to your database when you use replication (MDB)
    http://office.microsoft.com/en-us/access/HP052167961033.aspx

SummaryInfo
¯¯¯¯¯¯¯¯¯¯¯
This one is easy: it's the fields in (File | Database Properties...), [Summary Info]. No more, no less. New properties are of course hidden from the interface.

UserDefined
¯¯¯¯¯¯¯¯¯¯
Similarly, this is (File | Database Properties...), [Custom Properties]. This Document and Summary Info were clearly added to conform to the new Office standard, as Leigh pointed out.

Problem: Properties can have all the basic DAO data types (yes, even dbMemo with 60'000 characters), but Custom Properties are more restrictive: Text, Date, Number and Boolean.
Solution: (up to) Access 2002, the properties were cast back to String. In Access 2003, they are no longer displayed. However, they can be silently overwritten from the interface.

Goofs: Replicate Project was probably not meant to be in that collection, but rather in the Options, or in a Replica options dialog. This is the only User Defined Property used by Access.

    Troubleshoot replication (MDB)
    I don't want to replicate my forms, reports, macros, or modules ...
    http://office.microsoft.com/en-us/access/HP052167711033.aspx

Trivia: You can create a custom property having the same name as a built-in property, e.g. 'Permissions' or 'LastUpdated'. Tricky.


Conclusion
¯¯¯¯¯¯¯¯¯
The only apparent use of the Databases Container Documents is to hold properties. To us programmers, User Defined is of course the most useful. However, properties can also be "hidden" in any other Documents.

I have often created custom properties for CurrentDb; I will refrain from that in the future. Overwriting "Access Version" or any other system property is too risky, as unlikely as it seems; and new system properties can be added with each new version.


Cheers all, thanks for reading!

Markus ~ (°v°)
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
Function PrpValue(pprp As DAO.Property) As String
On Error Resume Next
    PrpValue = Nz(pprp.Value, "(null)")
    If Err Then
        PrpValue = "#Error " & Err.Number
        Err.Clear
    End If
End Function
 
Sub DatabaseProperties()
    Dim doc As DAO.Document
    Dim prp As DAO.Property
    Dim i As Integer
    With CurrentDb
        Debug.Print .Name
        For Each prp In .Properties
            Debug.Print "  "; prp.Name; ":"; Tab(40); PrpValue(prp)
        Next prp
        With .Containers("Databases")
            Debug.Print .Name
            For Each prp In .Properties
                Debug.Print "  "; prp.Name; ":"; Tab(40); PrpValue(prp)
            Next prp
        End With
        For Each doc In .Containers("Databases").Documents
            Debug.Print doc.Name
            i = 0
            For Each prp In doc.Properties
                i = i + 1
                If i > 8 Then
                    Debug.Print "  "; prp.Name; ":";
                    Debug.Print Tab(40); PrpValue(prp)
                End If
            Next prp
        Next doc
    End With
End Sub
Open in New Window
 
04.30.2008 at 10:10PM PDT, ID: 21476619

Rank: Genius

So, I ran this on an A2003 database.  From Help>>About Microsoft Office Access, the Version for A2003 shows  2003(11.6566.6568) SP2.

Running the code above shows the following related to Version from MSysDb - in an A2003 format MDB:

MSysDb
  ANSI Query Mode:                     0
  Themed Form Controls:                1
  AccessVersion:                       09.50               '****
  Build:                                         566                  
  ProjVer:                             35

So ... this seems .... ODD!
****************************************

When I run this code in an A2000 Format MDB - In A2003,


MSysDb
  ANSI Query Mode:                     0
  AccessVersion:           &nbs