Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Back to Scope    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Global variable initialization
Jeff Bartuch 
     
3 years ago
This video does a nice job explaining how to declare a variable publicly or globally, however is there a way to initialize a variable globally? Meaning X or whatever is the same throughout the database, but only has to be initialized one time and utilized throughout the database.
Kevin Yip  @Reply  
     
3 years ago
On way is to have a hidden form open when the database opens, and that form should set the values of all public variables right from the start.  You can make an Autoexec macro to open this form in hidden mode, and this form should have VBA code in the Open event that sets the public variables' values.  Database-wide public vars should be declared in a stand-alone module, of course.  If you don't use this method, you'll have to put this VBA code in every form, every report, etc., everywhere that uses the public variables, which is a lot more work.
Richard Rost  @Reply  
           
2 years ago
If the value never changes you can use a global  constant or System Defaults.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Scope.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 2/16/2026 10:19:21 PM. PLT: 0s