asked on
Function ShowControls()
Dim frmCust as Form
Dim i as Integer
Set frmCust = Forms("Customer")
For i = 0 To frmCust.Count - 1
Debug.Print frmCust(i).ControlName
Next i
End Function
And you want to do the same kind of exercise on a subform, how would you do it ?Public Function getControls()
Dim frm As Form
Dim ctl As control
DoCmd.OpenForm "Customer", acNormal, , , , acHidden
Set frm = Forms("Customer")
For Each ctl In frm.Controls
Debug.Print ctl.Name
Next
Set frm = Nothing
End Function
ASKER
Public Function getControls()
Dim frm As Form_Customer
Set frm = New Form_Customer
Dim ctl As control
For Each ctl In frm.Controls
Debug.Print ctl.Name
Next
Set frm = Nothing
End Function
In order for this to work your form should carry code behind....if you are uncertain on this just right click the form in question (Customer) --> Design View --> Design tab --> look for the button to enter VBE (on Access 2007 for example is called "View Code")Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.
TRUSTED BY
Open in new window