Discussion Locked

List all labels of all forms Access DB

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I would like to loop through all forms and for each form (open and closed) view all labels...

Anders

5 replies

by fofa

Basically you run through the FORMS objects checking to see if it is a LABEL, then capture the NAME property.

by andrew

Try this:

Dim f As Form
Dim c As Control
For Each f In Access.Forms
For Each c In f.Controls
If TypeOf c Is Label Then MsgBox c.Properties("Name")
Next
Next

by ae_maillist

This works:

Dim i As Integer
Dim f As Form
Dim c As control

For i = 1 To Application.CurrentProject.AllForms.Count
DoCmd.OpenForm Application.CurrentProject.AllForms.Item(i).Name
For Each f In Access.forms
For Each c In f.Controls
If TypeOf c Is Label Then
MsgBox f.Name & ", " & _
c.Properties("Name") & _
c.Properties("caption")
End If
Next c
Next f
DoCmd.Close

Next i

Thasnks for the inspiration...

This discussion is closed to new replies.