1. Tech

Your suggestion is on its way!

An email with a link to:


was emailed to:

Thanks for sharing About.com with others!

VBA - Accessing Access
Part2: VBA in Access
 More of this Feature
• Part 1: VBA - Accessing Access
• Part 3: Coding the Access Example
• Part 4: The Access Form: Our VBA Container
• Part 5: VBA Code Calling the Excel Server
• Part 6: The VBA Code
 Join the Discussion
Have you created a system using VBA Automation ?
Tell us about it!
 Related Resources
• Beginning Visual Basic
• Visual Basic 6
 From Other Guides
• About Databases
• About Business Software
 Elsewhere on the Web
• Professional Access 2000 Programming
From Wrox

• Updates from Microsoft
(Browse to Office 2000)


Access is another one of the most popular hosting environments for VBA, so it's appropriate that our next example be an Access database.

One of the first things you might notice when you select the familiar Tools > Macro in Access is that the resulting menu doesn't have a Record New Macro ... option. The bottom line is that Access is too varied and complex for this to work. Consequently, you have to write your Access VBA programs from 'scratch' without the running start that this tool gives you in other hosting environments. For similar reasons, the Record New Macro option is also missing in Outlook. Outlook and Access were also the last of the Office suite to get full VBA automation.

The Access VBA menu options

You shouldn't be surprised to discover that there are a number of other differences in the way you program VBA in Access versus the Word/Excel examples we saw previously. Another big difference is that Access almost requires you to add References to object libraries to your code to use it successfully. (In Word and Excel, if you don't use anything except the hosting application, it's not necessary.) Access VBA will normally be written to take advantage one of a number of optional database object libraries. From oldest to newest, they include RDO, DAO, and ADO with helpers like ODBC thrown in for good measure. (I always thought that the Access "JET engine" was the coolest acronym in programming - it expands to "Joint Engine Technology". MS has replaced it with ADO and ADO .NET today.) As Access guru Paul McFedries puts it, "You don't deal with 'documents' in Access. Instead you have a database 'container' that's filled with numerous other objects such as tables, forms, and reports."

Wizard Generated Access Objects

Next page > Coding the Access Example > Page 1, 2, 3, 4 5, 6

©2016 About.com. All rights reserved.