Visual Basic Tutorials:
|New! Download Access example of Global Variables as Query Parameters|
As this example show the declaration of a database global variable come right after the 'Option Compare Database' statement and before all declarations of (any) subroutines and functions within the form.
The definition of instance-wide Access global variables is carried out in a module. The following is the code we use to initialize our VBA global variables:
' Access global variables definition
Global GBL_Username As String
Global GBL_Previous_Tab As String
Public Sub Init_Globals()
' Access global variable initialization
GBL_Username = Environ("username")
GBL_Previous_Tab = " "
Then we make a call to the Init_Globals subroutine in our first-opening form as follows:
Private Sub Form_Open(Cancel As Integer)
As you can see there are many things you can keep track of with Access global variables. You can also do some neat tricks - like passing parameters to SQL queries using global variables.
Try our downloadable Access database demonstration of using Global variables as query parameters.
More Global Variable examples:
Global Variables as Query Parameters
Using global variables to pass user selection criteria to queries is a useful programming technique to master. This Access download will provide you with ...
Access Database Download: Access Security Alternative
Access Example Download, Download Access Examples Free. Home > Tutorials > Access Example Downloads ... Set global variables. Use the Dlookup function ...
Access Database Security Alternative
initialize global variables Call set_globals ' Hide tabs Me.TabCtl0.Pages. ... set global access level to failsafe no access then lookup access level ...
Blue Claw Database Design Downloadable Tutorial:
Choose Command Dynamic SQL Order By
A Blue Claw Database Design Template:
Loan Process Management Access Database
A Blue Claw Database Design Article:
How To Create Faster Access Databases
Copyright 2000-2014 Blue Claw Database Design