From the course: Access: VBA
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Create, export, and delete code modules
- [Instructor] When you are ready to write VBA code, that can be used anywhere in your database, not just attached to a particular form or other object. You can create a code module. I'll demonstrate how to do that in this movie. And I have opened the course database and moved to the Visual Basic Editor. I'll press Alt + F11. So here I am. If I want to create a new code module, I go to the Insert menu, and click Module. And here I have my code module. Any code module that you create using this method, starts with Option Compare Database. And what that does is take a look at the database to see if there are any changes that the code needs to account for when it runs. So that's there automatically and you shouldn't delete it. In this code module, you can create subroutines or functions. I'll create a subroutine that starts with the keyword Sub. And I'll just call it Hello. We don't need to send or pass any information to the subroutine. So I'll just time an open and close parenthesis…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
(Locked)
Introduction to object-oriented programming1m 59s
-
(Locked)
Examine the Access object model4m 57s
-
(Locked)
Work in the Visual Basic Editor3m 52s
-
(Locked)
Create, export, and delete code modules5m 47s
-
Create a subroutine5m
-
(Locked)
Create a function5m 26s
-
(Locked)
Add comments to your code4m 15s
-
(Locked)
Run a VBA procedure5m 7s
-
(Locked)
-
-
-
-
-
-
-
-
-