Unanswered: Printing the FE forms from an existing Database
Is there any way to print out *all* of the form designs from an Access 97 DB without having to go through and open each form physically and send it to the printer?
Ok, here's the scenario. I'm creating a new database using Access 97. However, I'm having to go off the physical design of the old DB to create the interface. Getting people sitting down together to tell me what they need and where is almost impossible. (Wave the magic wand and make it appear!).
What I need is just the physical form skins themselves...no code, no properties, just the interface (text boxes, labels, buttons, etc). To add a twist, I also don't have access to the original build files, so I can't get to things like the Analyzer.
I'm doubting this is possible, but, am hoping someone out there has had this problem (or that I'm out thinking myself and missing an obvious solution)
A form or a report is listed in the Documents collection of a Container object which is a member of the Containers collection of a Database object.
As far as I know however, forms and reports are like closed boxes when they are not instanciated and added to the Forms or to the Reports collection (i.e., when they are not open), and you cannot access to what is in them (their collections of controls (text boxes, labels, combos...), their modules etc.).
If you have a copy of the mdb file and the rights to open it as a database object nothing prevents you from opening its forms and its reports and then browse through their controls collection to gather all the information you need to rebuild the same objects in another database or even in another application (Several years ago I wrote a tools that can extract the properties of an Access form and build the skeleton of a VB6 form from the collected information).
It should be something like this:
Dim appAccess As New Access.Application
Dim ctl As Control
Dim pty As Property
Dim databasename As String
' Open the .mdb or .mde file using automation.
databasename = "C:\Documents and Settings\SinnDHo\My documents\Access\CF_Sit\CF_Sit_3\CF_Sit_20090710.mdb"
appAccess.OpenCurrentDatabase (databasename) ' optional parameters (exclusive, password) might be needed
' Open a form in the remote Access file.
' if the name of the form is unknown we can browse the Documents collection of the Forms container.
appAccess.DoCmd.OpenForm "Frm_Orders", acDesign ' Cannot use acDesign with a .mde file, use acNormal instead.
' Necessary because all properties are not accessible in every mode (acDesign, acNormal etc.
On Error Resume Next
' Browse through the controls collection of the form open in the remote Access file.
For Each ctl In appAccess.Forms("frmClientSearch").Controls
For Each pty In ctl.Properties
Debug.Print , pty.Name,
' Property not available in the mode used to open the form
If Err.Number Then
' Close the remote Access file and clean up
Set appAccess = Nothing
You don't need to have access to the original files? If the application is still running there must be a .mdb or .mde file somewhere, even in a remote location (on a server perhaps). This should be enough to use Automation and browse through the forms.