How to reference an Access subform

Referencing a control on an Access form is easy. Referencing a subform and its controls is a little more complex. To Access, a subform isn't a form at all, but a control, so you must reference it as such.

One of the most common mistakes I see, and hear about it, is improper syntax when referencing controls on a subform. As far as Access is concerned, a subform is just another control on the main form — and that's what confuses folks.

First, let's review referencing controls in general. Use either of the following syntax statements to reference a control on a main form:


(In more recent versions, you can substitute bang (!) with dot (.) between objects.)

To refer to a subform or a control on a subform, you must remember that Access treats the subform as a control. Essentially, you have a form with a control with a control. To express that arrangement in terms Access can decipher, you need the Form property as follows


In other words, subform is simply a control on the main form.

What I commonly see is a simple transposition of the Form property and subform, which generates a runtime error:


In this form, Access assumes Form is a control. When it can't find a control named form, Access returns an error.

By Susan Harkins

Susan Sales Harkins is an IT consultant, specializing in desktop solutions. Previously, she was editor in chief for The Cobb Group, the world's largest publisher of technical journals.