Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Access Form design

Posted on 2011-09-09
5
Medium Priority
?
198 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 48

Assisted Solution

by:Dale Fye
Dale Fye earned 668 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 668 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 35

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 664 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
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…

636 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