Solved

Using a global variable as criteria in query grid

Posted on 2012-03-12
4
376 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 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

724 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