Print Access Form Control Names and Sources in the Immediate Window
Question details
List an Access form's control types, names, and control sources in the VBA Immediate window.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- The user wants to run a VBA procedure from the Immediate window to inspect controls on a form.
- Observed behavior
- The Immediate window should display the type, name, and control source of each relevant control.
Identify the Access form you want to inspect and make sure the database is trusted so VBA code can run. The procedure below belongs in that form's module, not directly in the Immediate window.
Run a form-module procedure to list control sources
Use this method to print supported controls that have a nonempty Control Source.
The procedure checks text boxes, check boxes, combo boxes, list boxes, and option groups. A nonempty Control Source can be a field name or an expression, so inspect expressions separately if you only need bound fields.
In Access, open the form in Design View and select View Code to open its VBA module.
Paste this code into the form module: Public Sub GetBoundControls() Dim ctl As Control For Each ctl In Me.Controls Select Case ctl.ControlType Case acTextBox, acCheckBox, acComboBox, acListBox, acOptionGroup If Len(ctl.ControlSource & "") > 0 Then Debug.Print ctl.ControlType, ctl.Name, ctl.ControlSource End If End Select Next ctl End Sub
Save the module, return to Access, and open the target form. For example, open the form named employees.
In the VBA editor, press Ctrl+G to open the Immediate window. Enter Forms("employees").GetBoundControls and press Enter, replacing employees with the open form's name.

Review exported Access data in WPS Spreadsheets
WPS Office is a free, lightweight Office alternative with a familiar interface and Microsoft Office format compatibility. Export Access data to an Excel workbook to review it in WPS Spreadsheets; WPS does not run Access forms or fix Access VBA.

Frequently Asked Questions
Can I paste the entire procedure into the Immediate window?
No. Add the procedure to the form's VBA module using View Code, then use the Immediate window to call it.
Why does the form need to be open?
Forms("employees") refers to an open form. Open the form in Access before calling its public procedure from the Immediate window.
Does Control Source always contain a field name?
No. A Control Source can contain a field name or an expression. Check the Control Source property in the form's Property Sheet to distinguish them.
Can I put the procedure in a standard module instead?
Yes, but you must replace Me with a reference to the target form, such as Forms("employees"), and call the standard-module procedure by its name from the Immediate window.




