Microsoft Access Form References

Absolute references

Controls on a form:

Forms!frmMain!txtControlName.enabled = True

Controls on a Sub form:

Forms!frmMain!Subform1.Form!txtControlName.enabled = True

If the name is unique, shortcut naming will also work, so the above can be simplified to:


To refer to other control properties replace .enabled with the property name you need.

The default property is always .value (you can include .value if you want to make this absolutely clear.)

Properties of the whole FORM:


e.g. Forms!frmMain.RecordSource = “select * from my_table;”

Properties of a whole Sub form:


To refer to other form properties replace .RecordSource with the property name you need.

Relative references

Controls on a form:


Controls on a Sub form:

Me!Subform1.Form!txtControlName.enabled = True

Controls on a Parent form:


In these examples txtControlName is whatever name you have given the control e.g. txtSurname

To refer to other control properties replace .enabled with the property name you need.

e.g. txtControlName.Visible or txtControlName.BackColor

Properties of the whole FORM:


Properties of a Sub form:


Refer to properties of a Parent form:


To refer to other form properties replace .RecordSource with the relevant property name.

Sub-Sub forms

Nesting a subform inside another subform is rare, but for the sake of completion..

For these examples Subform1 is the name of a subform control on frmMain, Subform2 is the name of another subform control placed on Subform1. The name of form controls need not be the same as the name of the forms.

Controls on a nested Sub-Sub form:


Properties of a nested Sub-Sub form:


The parent of a Parent:


Using a relative reference on a form ensures that nothing will break if the form is renamed.

If you are writing an expression as part of an SQL statement, then use an absolute reference.

When referring to subforms, the subform object (on the main form) can have a different name to the form itself. For example when frmOrderLines is added to frmOrders as a subform, the new subform object could be called sfrOrderLines.
In the examples above we refer to the subform object name.

VBA Variables

An alternate syntax for VBA only, is written like: Forms("frmMain").ControlName
This syntax allows you to use a variable as part of the reference: Forms(strMyVariable).ControlName


SetFocus - Move focus to a specified field or control
Q209207 - Command-line switches for MS Access
Naming conventions - A copy of the famously detailed Reddick VBA Naming convention.
Microsoft Office online - Referring to an object or its properties in expressions

© Copyright 1999-2015
Some rights reserved