MS ACCESS 2007: VBA ENVIRONMENT INTRODUCTION
This MSAccess tutorial explains the VBA environment in Access 2007 (with screenshots and step-by-step instructions).
See solution in other versions of MSAccess:
WHAT IS VBA?
This is what the VBA environment looks like in Microsoft Access 2007:
VBA standards for Visual Basic for Applications and is the language embedded within your database in Access 2007.
You use VBA whenever you do one of the following:
- Create a new function.
- Create a new subroutine.
- Define a global variable.
- Place code behind an event procedure such as the "On Click" event of a command button.
- Execute the RunCode action in a macro.
These are just some of the examples of when you might be running VBA code.
MS ACCESS 2007: OPEN VBA ENVIRONMENT
This MSAccess tutorial explains how to open the VBA environment in Access 2007 (with screenshots and step-by-step instructions).
See solution in other versions of MSAccess:
HOW TO OPEN THE VBA ENVIRONMENT
You can access the VBA environment in Access 2007 by opening up the Microsoft Visual Basic window. The quickest way to do this is by pressing Alt+F11 while your Access database file is open.
This is an example of what the Microsoft Visual Basic window looks like.
MS ACCESS 2007: PROJECT EXPLORER IN VBA ENVIRONMENT
This MSAccess tutorial explains the Project Explorer within the VBA environment in Access 2007 (with screenshots and step-by-step instructions).
See solution in other versions of MSAccess:
PROJECT EXPLORER
The Microsoft Visual Basic window displays your VBA environment:
Next, let's take a few moments to analyze the various sections in the Microsoft Visual Basic window.
The Project Explorer can usually be found in the top left portion of the Microsoft Visual Basic window. It is a hierarchical listing of the objects recognized by VBA.
In this example, there is one "Microsoft Access Class Objects" - a form called frmProducts. There is also a Module called Module1.
These are all objects that you've created in your Access database that the VBA environment is aware of. The Project Explorer may not display all of your Access objects.
If the Project Explorer is not visible when you open the Microsoft Visual Basic window, you can make it visible by selecting Project Explorer under the View menu.
MS ACCESS 2007: PROPERTIES WINDOW IN VBA ENVIRONMENT
This MSAccess tutorial explains the Properties Window in the VBA environment in Access 2007 (with screenshots and step-by-step instructions).
See solution in other versions of MSAccess:
PROPERTIES WINDOW
The Microsoft Visual Basic window displays your VBA environment:
Next, let's analyze the Properties window in the VBA environment.
The Properties window is usually found directly below the Project Explorer in Access 2007. It displays the properties for the object currently highlighted in the Project Explorer. In the example above, it is displaying the properties for the module called Module1.
If the Project Explorer is not visible when you open the Microsoft Visual Basic window, you can make it visible by selecting Properties Window under the View menu.
MS ACCESS 2007: CODE WINDOW IN VBA ENVIRONMENT
This MSAccess tutorial explains the Code window in the VBA environment in Access 2007 (with screenshots and step-by-step instructions).
See solution in other versions of MSAccess:
CODE WINDOW
The Microsoft Visual Basic window displays your VBA environment:
Next, let's analyze the Code window in the VBA environment.
The Code window is usually found to the right of the Project Explorer in Access 2007. It displays the VBA code for the object currently highlighted in the Project Explorer. In the example above, it is displaying the VBA code for the module called Module1.
If the Code window is not visible when you open the Microsoft Visual Basic window, you can make it visible by selecting Code under the View menu.
MS ACCESS 2007: IMMEDIATE WINDOW IN VBA ENVIRONMENT
This MSAccess tutorial explains the Immediate Window in the VBA environment in Access 2007 (with screenshots and step-by-step instructions).
See solution in other versions of MSAccess:
IMMEDIATE WINDOW
The Microsoft Visual Basic window displays your VBA environment:
Next, let's analyze the Immediate window in the VBA environment.
In Access 2007, the Immediate window is usually found below the Code window. It is an essential element of the debugger found within the VBA environment. It lets you:
- Type code and press ENTER to view the results of the code.
- When in debug mode, it lets you view the value of a variable in its current state. This will be discussed in the tutorial on Debugging VBA Code.
If the Immediate window is not visible when you open the Microsoft Visual Basic window, you can make it visible by selecting Immediate Window under the View menu.
MS ACCESS 2007: OBJECTS DISPLAYED IN VBA ENVIRONMENT
This MSAccess tutorial explains what objects are displayed in the VBA environment in Access 2007 (with screenshots and step-by-step instructions).
See solution in other versions of MSAccess:
OBJECTS DISPLAYED IN THE PROJECT EXPLORER
The next important aspect to discuss is what objects appear in the Project Explorer.
At first glance, you'd assume that all of the Forms, Reports, and Modules that you create will automatically appear in the Project Explorer. But this is not true. The VBA environment only knows about the objects that you tag as "having a module".
So by default, all Modules will appear in the Project Explorer, but not all Forms and Reports necessarily will.
A Form will only appear in the Project Explorer if the Form's "Has Module" property is set to "Yes".
Similarly, a Report will only appear in the Project Explorer if the Report's "Has Module" property is set to "Yes".
Now, you're probably asking yourself, "How come some of the forms and reports in my Access database have the "Has Module" property set to "Yes" and others don't?"
Well, anytime that you invoke the Code Builder in a Form/Report, Access automatically sets Form/Report's "Has Module" property to "Yes".
Therefore, if you want to reference one of your Forms or Reports in the VBA environment, you may need to manually go to the Form/Report's Properties window and set the "Has Module" property to "Yes".
TUTORIAL SUMMARY
Microsoft Access is a unique tool released by Microsoft that provides both the functionality of a database and the programming capabilities to create end-user screens. Each version of Access can "look and feel" completely different from another.
In this Access 2007 tutorial, we covered the following:
- What is VBA?
- How to open the VBA environment
- Project Explorer
- Properties Window
- Code Window
- Immediate Window
- Objects displayed in the VBA environment
Each version of Access can "look and feel" completely different from another. As such, we recommend that you try one of our other Access tutorials to become familiar with the Access version that you will be using
0 comments:
Post a Comment
We Appreciate Your Feedback. Tell Us What You Think About Us. We Are Glad to Improve Our Service to You