Solved

Printing a List of Acess Forms

Posted on 2014-04-22
3
309 Views
Last Modified: 2014-04-22
Hi Experts,

Is there any quick way that I can print out a list of Access forms that are within a .accdb file?

I don't need anything fancy just a quick list.

Thank you,
0
Comment
Question by:APD_Toronto
3 Comments
 
LVL 12

Accepted Solution

by:
pdebaets earned 500 total points
ID: 40016143
From the OnClick event procedure of a command button on a form:

Dim i As Integer
With CodeProject
For i = 0 To .AllForms.Count - 1
    Debug.Print .AllForms(i).Name
Next i
End With

Open in new window


The output will show up in the Immediate Window. Press Ctrl-G while editing Visual Basic code to see the Immediate Window.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40016149
test this

Sub ListForms()
Dim db As database
Dim d As Document
Dim C As Container
Set db = CurrentDb()
Set C = db.Containers("Forms")
For Each d In C.Documents
    Debug.Print d.Name
Next d
End Sub
0
 
LVL 35

Expert Comment

by:PatHartman
ID: 40016173
You can use a query which gives you some flexibility on how you use the output.

SELECT MSysObjects.Name, MSysObjects.Type
FROM MSysObjects
WHERE (((MSysObjects.Type)=-32768))
ORDER BY MSysObjects.Name;


If you can't see the MSys tables, you can show them by going to Navigation Options and checking the Show System Objects box.

Each object type has a unique type code.  The MSys tables are not documented but if you have a database with a variety of objects, you should be able to see most of the available types.  Here's a list from my explorations:
Type      TypeDesc
-32768      Form
-32766      Macro
-32764      Reports
-32761      Module
-32758      Users
-32757      Database Document
-32756      Data Access Pages
1      Table - Local Access Tables
2      Access Object - Database
3      Access Object - Containers
4      Table - Linked ODBC Tables
5      Queries
6      Table - Linked Access Tables
8      Relationships
9      Constraints
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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.

791 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