Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Using a global variable as criteria in query grid

Posted on 2012-03-12
4
Medium Priority
?
383 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 - Microsoft MVP, Access and Data Platform) earned 2000 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

722 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