|< Day Day Up >|
After you've settled on Access as the place where you'll store your information, you still have decisions to make. One of these is which programming language to use with Access. VBA is not the only means available to automate your Access solutions; depending on the situation, you might also want to make use of Access macros or Structured Query Language (SQL) for some or all of your work.
You may already be familiar with the Access macro programming language, which provides a limited (though still useful) set of tools for automating database actions. For example, Figure 1.3 shows a simple macro that opens a single form. You can run this macro directly from the database container, or attach it to a button on another form.
Figure 1.3. Access macros provide a limited means of automating database actions.
Macros are useful but limited. We've seen some databases that do amazing things with macros, but if you're a power user, you'll soon hit their limits. In particular, macros have only a limited ability to respond to errors or other conditions out of the ordinary.
There's no need to remove working macros from a database if you've decided to switch to VBA. Access is perfectly able to mix the two automation languages in a single database.
You might also have heard of Structured Query Language, more commonly called SQL. SQL is the language that Access uses to store database queries. For example, you might want to find all the Web-related projects in a database of tasks. Figure 1.4 shows an Access query to perform this task.
Figure 1.4. The design view of an Access query is just a pretty face atop the query's SQL.
Although most users prefer to work with queries in design view, this isn't how Access saves your queries. Instead, it uses SQL for this purpose. Here's the SQL statement that corresponds to the query shown in Figure 1.4:
SELECT Projects.* FROM Projects WHERE (((Projects.ProjectName) Like "*Web*"));
Although SQL isn't a general-purpose programming language, you'll need to understand the basics to work with Access. That's because many automation tasks in Access involve retrieving particular data, and SQL is the way to do that.
If youre not familiar with SQL, you'll find a primer in Appendix A, "Review of Access SQL," page 347.
Finally, there's VBA, the focus of this book. VBA can automate just about any operation that you can perform in an Access database. Here are some of the things that we'll teach you to do throughout this book with VBA:
That's just a small sample; the possibilities are nearly limitless. To demonstrate the power of VBA, we'll start with a simple database and gradually make it more complex (and useful).
|< Day Day Up >|