Home  Fees/Services  Access 2010 Template  Access Tutorial  Access Download  Articles  Search  Contact  Privacy  Links

Referring to Subforms in VBA
Access Forms & Subform Reference Methods

Visual Basic Tutorials:
Access-Google Earth
Age Calculation
Change To Proper Case
Email via Gmail #1
Send Gmail Email #2
Inactivity Logout Code
Outlook Email
Read Email Access
Email Attachment
Send Outlook Email
Running Sum
Concatenate Records
Stock Quotes
Find Database Path
Detail-Master Update
Data Field Validation
Field Value New-Old
Access Version
Global Variable Parameter
Global Variables
Active Labels
Files List Box
Mail Merge
Quick Sort
Recordset Filters
Reference Form Field
Select Case
Access Transactions

Visual Basic Function Examples

Reference Nested Form Fields in VBA

Reference Microsoft Access Form Controls from VB Script

Have you come across the maddening task of trying to reference a deeply nested form, form field or control? Here is a real example of a deeply nested subform control - a combo box control which we want to disable.

Our Access Programmers work with clients all over the world through the Internet. Let us help you today: contact page

We also have 100's of programming examples from simple to complex. You can jump to our Access tutorials here. Visit our contact page if you have comments or questions.

.Form![Parameter_Combo].Enabled = False

Isn't there an easier way to reference these fields directly?  The answer is YES!

You can reference any form directly using its reference in visual basic:

Form_F_Test_Result_Parameters.Parameter_Combo.Enabled = False

Notice that we prefix the form name with Form_ use the dot '.' operator to reference the form control.

There is one trick to this referencing method - the form which you are referencing must have its Has Module property set to Yes.

This method only seems to work in VBA code.  Doesn't work when referencing a form field as a query parameter nor in any of the property settings.

Note that you can also reference a form's functions and subroutines using the same method.  For example:

(requeries the form)

Call Form_F_Test_Result_Parameters.Find_Test_Combo_AfterUpdate
(Note that the function or subroutine must be Public and not Private to reference it from another form or VBA module.)

And requery a combo box after its row source updates:


Blue Claw Database Design Downloadable Tutorial:
Union Query (Advanced) Access Tutorial Download  

A Blue Claw Software Design Template:

Construction Project Software

A Blue Claw Database Design Article:

Computer Disaster Recovery Planning

Microsoft Office:
MS Access 2000 Through 2016 and Office 365 & Sharepoint

Contact Information

Copyright 2000-2017 Blue Claw Database Design

Microsoft Access 2007, 2010, 2013 & 2016