Others

Print Access Form Control Names and Sources in the Immediate Window

Bushra ParveenBushra Parveen Nov 14, 2026 868 views

Question details

List an Access form's control types, names, and control sources in the VBA Immediate window.

Print Access Form Control Names and Sources in the 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.
Before you start

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.

Solution 1Recommended

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.

1
Open the form module

In Access, open the form in Design View and select View Code to open its VBA module.

2
Add the procedure

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

3
Open the form

Save the module, return to Access, and open the target form. For example, open the form named employees.

4
Call the procedure

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.

Run a form-module procedure to list control sources
Reading the output: Each line contains the numeric control type, control name, and Control Source. Controls with an empty Control Source are skipped.
Free Microsoft Office alternative

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.

Review data exported from Access in a spreadsheetOpen and edit Microsoft Excel XLSX filesUse a familiar spreadsheet interface for an easier transitionWork with a free, lightweight office suite
microsoft office alternative - wps office

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.