Solved

Access Form design

Posted on 2011-09-09
5
191 Views
Last Modified: 2012-05-12
This is really 2 questions, but same issue that I dont even know if its possible.

Is it possible using VBA to list all the forms in an Access database, then look at each element on that form, and read the values of that controls position on the form.

Im trying to document one of our database's and I can already easily do the tables and queries, but Im stuck on the forms, and would really like to creat a report which just lists all the text boxes, combos buttons etc and their positions on the page.

Thanks in advance for any help.
0
Comment
Question by:tonelm54
5 Comments
 
LVL 47

Assisted Solution

by:Dale Fye (Access MVP)
Dale Fye (Access MVP) earned 167 total points
ID: 36511380
For each frm in currentproject.allforms
    For each ctrl in frm.controls
        debug.print ctrl.Name, ctrl.left, ctrl.Top, ctrl.width, ctrl.height
    Next ctrl
Next frm
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 36511395
<Is it possible using VBA to list all the forms in an Access database, then look at each element on that form, and read the values of that controls position on the form.
>  the Answer is YES

but, before we go there,

have you tried using the Documenter ?

Tools > Analyze  > Documenter
0
 
LVL 39

Assisted Solution

by:Aaron Tomosky
Aaron Tomosky earned 167 total points
ID: 36511409
Here is an example of someone using vba to open a form, loop through all controls, and save some properties to a table. If you modify this to grab the properties you want it should work
http://www.access-programmers.co.uk/forums/showthread.php?t=125730
0
 
LVL 33

Expert Comment

by:Norie
ID: 36511578
Here's some very crude code.
Option Compare Database
Option Explicit

Sub DocumentForms()
Dim frm
Dim ctl As Control

    For Each frm In CurrentProject.AllForms
      DoCmd.OpenForm frm.Name, acDesign
      
        Debug.Print frm.Name
        
        For Each ctl In Forms(frm.Name).Controls
            Debug.Print Space(10) & ctl.Name & ":" & TypeName(ctl)
            Debug.Print Space(15) & "Top:     " & ctl.Top
            Debug.Print Space(15) & "Left:     " & ctl.Left
            Debug.Print Space(15) & "Height:  " & ctl.Height
            Debug.Print Space(15) & "Width:   " & ctl.Width
        Next ctl
        
        DoCmd.Close acForm, frm.Name
        
    Next frm
End Sub

Open in new window

0
 
LVL 26

Accepted Solution

by:
Nick67 earned 166 total points
ID: 36511605
If you want to go with complete overkill, you can use the undocumented SaveAsText
SaveAsText acForm, "Form1", "C:\temp\Form1.txt"
You'll get a txt file with a boatload more detail than you'll ever want
The undocumented LoadFromText will pull these textfiles back into a database
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question