|< Day Day Up >|
The Visual Basic Editor (VBE) is the interface you'll use to write VBA code. Figure 2.1 shows the VBE window for the TimeTrack sample database. The easiest way to launch the VBE is to open Access, load the database, and then press Alt+F11. (If you're following along with an existing database, the VBE may display some code when you first open it.)
Figure 2.1. Welcome to the Access Visual Basic Editor.
In this chapter, we'll introduce you to the many components you'll be working with and even let you enter a bit of code. We won't spend a lot of time learning about every single element, tool, and menu command in the VBE you'll learn about them later by actually using them as you produce example code. For now, just familiarize yourself with the development environment so you'll be on friendly ground later.
By default, the VBE displays the following components:
Individual windows in the VBE are dockable, just like most menus and toolbars. Double-click the title bar of a window to toggle docked and floating.
Table 2.1 describes the tools on the VBE's standard toolbar, which is shown in Figure 2.1. These are the tools you'll use most of the time.
Other tools are available on the three additional toolbars, two of which are shown in Figures 2.2 and 2.3. You'll learn more about the tools on these toolbars as you work through the examples in this book. A fourth toolbar, UserForm, is available, but we won't cover UserForms or the toolbar in this book.
Figure 2.2. Debug tools help you quickly squash bugs in your code.
Figure 2.3. Use Edit tools to produce efficient code.
We won't be using UserForms because Access has its own forms, with which you should already be familiar. Access forms are more powerful and flexible than UserForms. Why, then, do UserForms even exist? The answer is that the VBE, and VBA itself, are shared components. You'll find VBA implemented in dozens of software packages, including other Microsoft Office applications, Autodesk's AutoCAD drawing package, Peachtree Office Accounting, and more. These other products, which lack their own forms interface, benefit from the inclusion of UserForms in VBA.
To display a toolbar, choose View, Toolbars and click the appropriate toolbar item: Debug, Edit, or Standard. (Uncheck an item to hide the toolbar.)
|< Day Day Up >|