[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Access Form design

Posted on 2011-09-09
5
Medium Priority
?
200 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 49

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

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

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

If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
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…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

810 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