Twitter
LinkedIn
YouTube
RSS
Facebook

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.
1

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


Get all the videos in this Access VBA collection 100% FREE by signing up at http://vbahowto.com/ms-access-tutorial

Helpful? Consider giving us a tip. Thanks!

($5 suggested amount)
(...10% of your gift amount will go to charity)




Want All The Access Videos?, Click Here!





Need help? Click and Call LoeblCom Services



Leave a Reply

You must be logged in to post a comment.