Variable Scope & Visibility in Microsoft Access VBA (Public, Private, Dim, Global, etc.)

  Рет қаралды 6,550

Computer Learning Zone

Computer Learning Zone

Жыл бұрын

In this Microsoft Access tutorial, I will teach you about variable scope and visibility in VBA. We'll learn about public vs. private, the keywords dim and global, and the different scopes including procedure-level, form-level, and database-level.
Sandra from Norfork, Arkansas (a Gold Member) asks: Can I use Dim X as String on multiple buttons on one form, or does each button require a separate character? I've watched lots of videos, but have not found one yet that answers this question.
LEARN MORE:
599cd.com/Scope
PRE-REQUISITES:
Intro to VBA: 599cd.com/IntroVBA
Variables: 599cd.com/Variables
For Next Loops: 599cd.com/ForNext
RECOMMENDED COURSES:
Access Developer 4: 599cd.com/ACD4
Access Developer 31: 599cd.com/ACD31
LINKS:
Value From a Form: 599cd.com/FormName
Microsoft Scope & Visibility: docs.microsoft.com/en-us/offi...
BECOME A MEMBER:
KZbin: / @599cd
or My Site: 599cd.com/THMember
ADDITIONAL RESOURCES:
FREE Access Beginner Level 1: 599cd.com/Free1
$1 Access Level 2: 599cd.com/1Dollar
Donate to my Tip Jar: 599cd.com/TipJar
Get on my Mailing List: 599cd.com/YTML
Contact Me: 599cd.com/Contact
TechHelp: 599cd.com/TechHelp
Consulting Help: 599cd.com/DevNet
Twitter: / learningaccess
en.wikipedia.org/wiki/Microso...
products.office.com/en-us/access
microsoft.com/en-us/microsoft...
KEYWORDS
access 2016, access 2019, access 2021, access 365, microsoft access, ms access, ms access tutorial, #msaccess, #microsoftaccess, #help, #howto, #tutorial, #learn, #lesson, #training, #database, #fasttips, Understanding variable scope and visibility, vba, invalid outside procedure, variable not defined, can't find the field referred to in your expression, run-time error '2465', application-defined or object-defined error, dim, private, public, global, compile invalid attribute in sub or function, procedure-level, form-level, database-level
QUESTIONS:
Please feel free to post your questions or comments below. Thanks.

Пікірлер: 21
@petewarby7158
@petewarby7158 9 ай бұрын
I mean this is UNBELIEVABLE. I have been trying for days to find a way to do something re using field values between forms and this has nailed it! I'm creating a gallery form for my wife's cake business and couldn't figure how to grab text field contents to copy to another form's field to load the image from. This is AWESOME. I should bin Google off and just trawl your videos. Brilliant. BRILLIANT. I've commented before to say my entry level database would have been BORING but your videos have turned it in to (what i think) is a work of art!!!
@599CD
@599CD 9 ай бұрын
Awesome. Glad you find them helpful.
@coderdecoder5947
@coderdecoder5947 Жыл бұрын
Excellent. I’m truly impressed with your teaching ability and the way you organize things.
@599CD
@599CD Жыл бұрын
Thanks
@rabidfollower
@rabidfollower Жыл бұрын
Excellent video, and an important topic too since the concept of scope and visibility applies to any programming language. Sometimes you also need to use naming convention to denote scopes. I use "G_" to prefix all global-level variables and "M_" to denote module-level ones.
@599CD
@599CD Жыл бұрын
Thank you.
@ashishtrivedi8253
@ashishtrivedi8253 Жыл бұрын
You have explained scope of variable in great detail and with working codes. That was great help, thx a ton.
@599CD
@599CD Жыл бұрын
You are welcome!
@MadGenious
@MadGenious Жыл бұрын
Man Access is old school.. really wish you start making Oracle 19c courses, you teach really well and i have no one to guide me even tho it's alot better than access especially at large scale databases.
@599CD
@599CD Жыл бұрын
Access is where it's at.
@stuartround
@stuartround Жыл бұрын
Really useful and beautifully explained. Thank you!
@599CD
@599CD Жыл бұрын
Glad you enjoyed it!
@venkatyalamati3285
@venkatyalamati3285 Жыл бұрын
Thanks for the tutorial sir!!!
@599CD
@599CD Жыл бұрын
My pleasure!
@glennpitts1312
@glennpitts1312 10 ай бұрын
This is a great lesson on this topic Richard. I haven't been able to specify a Public Variable in a query (a separate form) as defined (by name).. Do you need to use a function to do that? ]
@599CD
@599CD 10 ай бұрын
599cd.com/QQ
@artistryartistry7239
@artistryartistry7239 Жыл бұрын
1:47 isn' there module level too?
@599CD
@599CD Жыл бұрын
Well, there are FORM modules and DATABASE modules (global modules) so that's why I didn't just say "module-level." Who's module is it?
@artistryartistry7239
@artistryartistry7239 Жыл бұрын
@@599CD Gotcha. It's amazing the number of terms surrounding modules their rules and their variables!
@GCCONLINECLASSES
@GCCONLINECLASSES Жыл бұрын
FRRRR all the layering n buttons i cant keep up
@599CD
@599CD Жыл бұрын
Layering? Not me.
Tips on Copy & Paste Technique for Microsoft Access Form & Report Controls
8:24
Computer Learning Zone
Рет қаралды 10 М.
Best father #shorts by Secret Vlog
00:18
Secret Vlog
Рет қаралды 22 МЛН
When You Get Ran Over By A Car...
00:15
Jojo Sim
Рет қаралды 29 МЛН
Clowns abuse children#Short #Officer Rabbit #angel
00:51
兔子警官
Рет қаралды 49 МЛН
DO YOU HAVE FRIENDS LIKE THIS?
00:17
dednahype
Рет қаралды 103 МЛН
Understanding Recordsets in Microsoft Access VBA - a Beginner's Guide
20:48
Computer Learning Zone
Рет қаралды 7 М.
Hide Access Splash Screen
4:14
Isladogs On Access
Рет қаралды 2,5 М.
12 Tips to Get More Done Using Microsoft Outlook
26:43
Jonathan Edwards
Рет қаралды 73 М.
Best father #shorts by Secret Vlog
00:18
Secret Vlog
Рет қаралды 22 МЛН