Home  Fees/Services  Access Templates  Tutorials  Access Download  Articles  Search  Contact  Privacy  Links

Microsoft Access Download
Global Variables for Access SQL Query Parameters

Global Variables in VBA as Query Parameters Access Database Downloads

 Access Downloads> Global Variables as Parameters

 
 

How To Open Email Using SendObject Access Example Download

Send Email Access Sample Download (Advanced)

Programming MS Access Security Alternative

Inventory Calculations Down Load ( Single User)

How To Perform Inventory Calculations (Multi-User)

Make Dependent Combo Box Code Access Database Download

Union Query Example (Simple)

Union Query (Advanced)

How To Fill Fields From Combo Box

Use Global Variables as Parameters

Download Continuous Form Dependent Combo Box

How To Program Continuous-Continuous Master/Detail Forms

Download Example for Bar Chart/ Bar Graph on Access Forms

Programming Crosstab Query Example

TransferText & OutputTo Examples

DoCmd.OpenForm & OpenArgs VBA Example

Running Sum Query Method

Choose Command Dynamic SQL Order By

Access Conditional Format

Access Report Banding

Popup Form Control Method


Visual Basic 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 all the forms, modules, queries and VBA code to get you started.

Here is the SQL query code used in the example:

SELECT M_Student_Courses.Student_ID, L_Students.Student, L_Courses.Course
FROM (M_Student_Courses INNER JOIN L_Students ON M_Student_Courses.Student_ID = L_Students.Student_ID) INNER JOIN L_Courses ON M_Student_Courses.Course_ID = L_Courses.Course_ID
WHERE (((M_Student_Courses.Student_ID)=get_global('gbl_student_id')))
ORDER BY L_Students.Student, L_Courses.Course;

In the code above, get_global is a function that passes back the value of any global variable you have defined.  In this case we are retrieving the GBL_Student_ID which was previously selected as a parameter in the form below.

There are other methods for returning global variables, such as the Eval function, however we find this custom method more reliable and flexible.

Give our Global Variables as Query Parameters downloadable Access example a try.
 

Download Global Variable Access



If you have arrived at this Microsoft Access download page directly then don't miss our Access Database Tutorial

 

Microsoft Access support



Contact Information 

Access Database Downloads
MS Access 2003 Download Access 2000 Downloads 2002

Access Database Examples • Microsoft Access Templates • MS Access Tutorials