Solved

Using a global variable as criteria in query grid

Posted on 2012-03-12
4
372 Views
Last Modified: 2012-06-22
I am trying to set a global variable from a form module...then reference the global variable in the criteria of a query grid.   The attached file lays out the 3 steps.   I am failing miserable.  Your expert help would be appreciated.
0
Comment
Question by:Dwood9015
  • 3
4 Comments
 
LVL 75
ID: 37712629
Well, you can't do that in A2003 or prior.  However, in >=A2007, you can use the TempVars collection to do that.

What version are you using?

mx
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) earned 500 total points
ID: 37712632
Another work around is to call a Function from the query that returns the current value of the Global variable.  You just cannot reference it directly (in A2003 or prior).

mx
0
 

Author Comment

by:Dwood9015
ID: 37712704
That worked...Thanks

Option Compare Database

Global FilterFacility As String

Public Function GetFilterFacility() As Variant
  GetFilterFacility = FilterFacility
End Function
0
 
LVL 75
ID: 37712708
Exactly!

So, what version of Access are you using?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now