A Variable Scope

Key points:

A private procedure can be called from any procedure in the same module.
The default scope for a sub procedure is “Public” unless you specifically designate it as Private.

Store all your procedures and functions you plan to use in your application in “Modules”, which you can call from your other database objects.

Here is the video:

Here is a handy chart for you to use when determining VBA variable scope:

Keyword Result
Dim The variable is only available inside the procedure in which it is declared.
Private The variable is available to all procedures in the module in which it is declared, but not to procedures in other modules in the application.
Public The variable is available to all procedures in all modules in the application.

<< How To Make A VBA Function | VBA Debug Part 1 >>

Free! Subscribe To Our YouTube Channel!

facebooktwittergoogle_plusredditpinterestlinkedinmailby feather
Tags: , , , , ,


Call Erik Now