Access VBA, Referencing Forms

In this article I will explain how you can reference access forms using VBA. For example:

Form_MyTable1.Recalc
Form_MyTable1.Requery
Form_MyTable1.Controls.Item (1)
Form_MyTable1.Width = 45

but before this can be done the Form_MyTable1 needs to be created. This can be done by following the steps below:


Step 1:

Double click the form on the left sidebar:
Double Click


Step 2, Select Design View:

Select design view:
Design View


Step 3:

On the Design Ribbon click on the View Code button:
View Code


Step 4:

By following the steps above a new Class Object will be created:
Class Object
You will now be able to refer to the form using the Form_MyTable1 object. For example:

Form_MyTable1.Recalc
Form_MyTable1.Requery
Form_MyTable1.Controls.Item (1)
Form_MyTable1.Width = 45

You can download the sample file used in this article from the link below:

If you need assistance with your code, or you are looking for a VBA programmer to hire feel free to contact me. Also please visit my website  www.software-solutions-online.com

Leave a Reply

Your email address will not be published. Required fields are marked *