[AccessD] enumerating all properties in all forms

John W. Colby jwcolby at colbyconsulting.com
Thu Feb 17 17:35:05 CST 2005


Yes, but you can open it in design view, hidden.  You can then get at all
the properties.

John W. Colby
www.ColbyConsulting.com 

Contribute your unused CPU cycles to a good cause:
http://folding.stanford.edu/

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust
Sent: Thursday, February 17, 2005 6:27 PM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] enumerating all properties in all forms


I didn't use DAO, Susan.  Don't be misled by this:   Set dbs =
CurrentProject.  The object dbs is declared as an object, not as a database.
My code will work in an all ADO database, 2000 and later.  

Your real problem is that most of the form's built-in properties are only
accessible if it is loaded.  If you want to enum all the properties, I'm
afraid you may have to load any form that isn't already loaded and then
close it again.

Charlotte Foust


-----Original Message-----
From: Susan Harkins [mailto:ssharkins at bellsouth.net] 
Sent: Thursday, February 17, 2005 2:55 PM
To: 'Access Developers discussion and problem solving'
Subject: RE: [AccessD] enumerating all properties in all forms


An interesting solution -- interesting that both you and Charlotte used DAO.
:)  

Susan H. 

Susan,

Probably slower, but could you do something like this:

    Dim db As DAO.Database, doc As Document, frm As Form, prp As Property
    Set db = CurrentDb
    For Each doc In db.Containers!Forms.Documents
        Debug.Print doc.Name
        DoCmd.OpenForm doc.Name, acNormal, , , , acHidden
        Set frm = Forms(doc.Name)
        For Each prp In frm.Properties
             Debug.Print prp.Name, prp.Value
        Next
        DoCmd.Close acForm, doc.Name, acSaveNo
    Next
    Set db = Nothing

Hope this helps,

Don

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Susan Harkins
Sent: Thursday, February 17, 2005 12:12 PM
To: 'Access Developers discussion and problem solving'
Subject: RE: [AccessD] enumerating all properties in all forms


Yeah, the Help doesn't really give too much information, but my guess is
that the AccessObjectProperties aren't the same as the form properties. 

I need to get at the form's properties for ALL the forms, not just the open
ones, so I need to use the AccessObject. 

Susan H. 

Hi Susan

Perhaps simply no AccessObjectProperty is present ..?

/gustav

>>> ssharkins at bellsouth.net 17-02-2005 20:43:45 >>>
The following procedure seems to totally skip the second For Each loop. No
error, it just skips it, as if there are no properties in the Properties
collection, which may be the case. I realize we're dealing with different
collections and I may not be referencing things right. Any help?
 
Thanks!
Susan H. 
 
 
Public Function EnumAllFormProp()
  'Print the name and setting for
  'each property in every form.
  Dim obj As Access.AccessObject
  Dim prp As Access.AccessObjectProperty
  For Each obj In CurrentProject.AllForms
    Debug.Print obj.Name
    For Each prp In obj.Properties
      Debug.Print prp.Name
      Debug.Print prp.Value
    Next
  Next
End Function

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com






More information about the AccessD mailing list