Defining and using an object variable


show more Defining and using an object variable provides you with in-depth training on Business. Taught by Curt Frye as part of the Up and Running with VBA in Access show less
please wait ...

Defining and using an object variable

When you want to use VBA to manipulate a table, form, or other database object, you need to assign that object to a variable. Those variables are, not surprisingly, called object variables. For this movie we will use the Object Variables code module that I have here in the Navigation pane, so I will double-click it to display it. The Module contains just a skeleton of an ObjectVariables subroutine, so I will click between the Sub and End Sub statements to start working. You declare an object variable the same way you declare any other variable.

You just specify the type of object you want that variable to represent. So let's say that I want to create an object variable for a form. For that I will Dim, space, then the name of a variable. And I usually just type in myForm to refer to a form, then As, space, and then the word Form, and Return. So now Access understands that the variable myForm will represent a form within the database.

After you declare the object variable, you use the Se...

Defining and using an object variable
Video duration: 4m 26s 4h 38m Advanced

Viewers:

Defining and using an object variable provides you with in-depth training on Business. Taught by Curt Frye as part of the Up and Running with VBA in Access

Subjects:
Business Developer IT
Software:
Access Visual Basic
Author:
please wait ...