|
 |
access thread: print properties of MS Access forms and their controls from forms that are closed
Message #1 by "Bill Findlay" <findlay@t...> on Wed, 11 Dec 2002 21:11:22
|
|
I am trying to locate all the references to macros in forms and their
controls. How would I go about printing the properties of MS Access forms
and their controls from forms that are CLOSED. I just can't seem to find
the correct syntax.
Bill Findlay
Message #2 by "Bob Bedell" <bobbedell15@m...> on Thu, 12 Dec 2002 05:37:59 +0000
|
|
Can't be done in Access. Forms and Reports have to be opened in design
mode to access the definition properties for each control. Your
standard utility that does the kind of thing you're trying to do will
have a routine that opens the form in design mode behind the scenes at
run-time (DoCmd OpenForm objName, A_DESIGN), loops through property
definitions (For i = 0 To frm.Properties.Count - 1 kinda' thing)
writing each to a recordset, and then closes the form. On to the next
object your code is documenting...
>From: "Bill Findlay" <findlay@t...>
>Reply-To: "Access" <access@p...>
>To: "Access" <access@p...>
>Subject: [access] print properties of MS Access forms and their controls
>from forms that are closed
>Date: Wed, 11 Dec 2002 21:11:22
>
>I am trying to locate all the references to macros in forms and their
>controls. How would I go about printing the properties of MS Access forms
>and their controls from forms that are CLOSED. I just can't seem to find
>the correct syntax.
>
>Bill Findlay
_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
Message #3 by "Brian Skelton" <brian.skelton@b...> on Thu, 12 Dec 2002 09:01:11 -0000
|
|
Bill
What version of Access are you using?
In Access 97 you'll need to look at the Containers collection. In Access
2000/XP I think there's an AllForms collection.
Brian
-----Original Message-----
From: Bill Findlay [mailto:findlay@t...]
Sent: 11 December 2002 21:11
To: Access
Subject: [access] print properties of MS Access forms and their controls
from forms that are closed
I am trying to locate all the references to macros in forms and their
controls. How would I go about printing the properties of MS Access
forms
and their controls from forms that are CLOSED. I just can't seem to
find
the correct syntax.
Bill Findlay
Message #4 by "Bob Bedell" <bobbedell15@m...> on Fri, 13 Dec 2002 01:14:12 +0000
|
|
Please let me know if I have this wrong, but I think that there is no
way to enumerate the properties and property values of a closed form
(or report for that matter), except for some very general Name,
Createdby, DateCreated, Type, DateModified sorts of properties provided
by the collections like AllForms or Containers. What's really needed
for the kind of documentation Bill has in mind is code like the
following that only works with open forms:
Sub Forms1()
Dim frm As Form, prp As Property
' Enumerate Forms collection.
For Each frm In Forms
' Print name of form.
Debug.Print frm.Name
' Enumerate Properties collection of each form.
For Each prp In frm.Properties
' Print name and value of each property.
Debug.Print prp.Name; " = "; prp.Value
Next prp
Next frm
End Sub
To do this sort of thing, however, the form needs to be open, even if
its only opened and closed by code in the background, and for the sole
purpose of enumerating properties. Every other way I've run across to
get at form properties, opened or closed, follows. None of them,
however, get at the design-time property definitions of closed forms,
much less the property definitions of controls on closed
forms.
Sub Forms2()
Dim dbs As DAO.Database
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset
Dim strSQL As String
Dim strQuery As String
Set dbs = CurrentDb
strSQL = "SELECT MSysObjects.Name, MSysObjects.Type "
strSQL = strSQL & "FROM MSysObjects "
strSQL = strSQL & "WHERE MSysObjects.Type=-32768;"
DoCmd.DeleteObject acQuery, "qryForms"
Set qdf = dbs.CreateQueryDef("qryForms", strSQL)
Set rst = qdf.OpenRecordset(dbOpenSnapshot)
Do While Not rst.EOF
Debug.Print "Form from MSysObjects: " & rst!Name
rst.MoveNext
Loop
rst.Close
End Sub
Sub Forms3()
Dim dbs As DAO.Database
Dim doc As DAO.Document
Set dbs = CurrentDb
For Each doc In dbs.Containers("Forms").Documents
Debug.Print "Form: " & doc.Name
Next doc
End Sub
Sub Forms4()
Dim obj As AccessObject
Dim dbs As Object
Dim intReturn As Integer
Set dbs = Application.CurrentProject
intReturn = MsgBox("Print just loaded forms?", vbYesNo)
For Each obj In dbs.AllForms
If intReturn = vbYes Then
If obj.IsLoaded = True Then
Debug.Print "Loaded form: " & obj.Name
End If
ElseIf intReturn = vbNo Then
Debug.Print "Form: " & obj.Name
End If
Next obj
End Sub
Best,
Bob
>From: "Brian Skelton" <brian.skelton@b...>
>Reply-To: "Access" <access@p...>
>To: "Access" <access@p...>
>Subject: [access] RE: print properties of MS Access forms and their
>controls from forms that are closed
>Date: Thu, 12 Dec 2002 09:01:11 -0000
>
>Bill
>
>What version of Access are you using?
>
>In Access 97 you'll need to look at the Containers collection. In Access
>2000/XP I think there's an AllForms collection.
>
>Brian
>
>-----Original Message-----
>From: Bill Findlay [mailto:findlay@t...]
>Sent: 11 December 2002 21:11
>To: Access
>Subject: [access] print properties of MS Access forms and their controls
>from forms that are closed
>
>I am trying to locate all the references to macros in forms and their
>controls. How would I go about printing the properties of MS Access
>forms
>and their controls from forms that are CLOSED. I just can't seem to
>find
>the correct syntax.
>
>Bill Findlay
>
>
_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
http://join.msn.com/?page=features/virus
Message #5 by "Bill Findlay" <findlay@t...> on Mon, 30 Dec 2002 16:58:21
|
|
Hi Bob!
Thanks for the prompt reply. I think that your approach is the only way.
I'll give it a shot.
Merry Christmas and a great New Year to you and yours.
Bill Findlay
> Can't be done in Access. Forms and Reports have to be opened in design
mode to access the definition properties for each control. Your
standard utility that does the kind of thing you're trying to do will
have a routine that opens the form in design mode behind the scenes at
run-time (DoCmd OpenForm objName, A_DESIGN), loops through property
definitions (For i = 0 To frm.Properties.Count - 1 kinda' thing)
writing each to a recordset, and then closes the form. On to the next
object your code is documenting...
>From: "Bill Findlay" <findlay@t...>
>Reply-To: "Access" <access@p...>
>To: "Access" <access@p...>
>Subject: [access] print properties of MS Access forms and their controls
>from forms that are closed
>Date: Wed, 11 Dec 2002 21:11:22
>
>I am trying to locate all the references to macros in forms and their
>controls. How would I go about printing the properties of MS Access forms
>and their controls from forms that are CLOSED. I just can't seem to find
>the correct syntax.
>
>Bill Findlay
_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
Message #6 by "Bill Findlay" <findlay@t...> on Mon, 30 Dec 2002 17:01:52
|
|
Hi Brian!
Many thanks to you also for the prompt reply. I am using Access '97. I
think that I will have to open the forms programatically in design mode to
access the properties that I want.
Merry Christmas and Happy New Year.
Bill Findlay
> Bill
What version of Access are you using?
In Access 97 you'll need to look at the Containers collection. In Access
2000/XP I think there's an AllForms collection.
Brian
-----Original Message-----
From: Bill Findlay [mailto:findlay@t...]
Sent: 11 December 2002 21:11
To: Access
Subject: [access] print properties of MS Access forms and their controls
from forms that are closed
I am trying to locate all the references to macros in forms and their
controls. How would I go about printing the properties of MS Access
forms
and their controls from forms that are CLOSED. I just can't seem to
find
the correct syntax.
Bill Findlay
Message #7 by "Bob Bedell" <bobbedell15@m...> on Mon, 30 Dec 2002 18:25:35 +0000
|
|
Merry Christmas and a great New Year to you and yours as well, Bill.
_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 3 months FREE*.
http://join.msn.com/?page=features/featuredemail&xAPID=42&PS=47575&PI=7324&DI=7474&SU=
http://www.hotmail.msn.com/cgi-bin/getmsg&HL=1216hotmailtaglines_addphotos_3mf
|
|
 |