Solved

Using a global variable as criteria in query grid

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

Expert Comment

by:DatabaseMX (Joe Anderson - Access MVP)
Comment Utility
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
Comment Utility
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
Comment Utility
That worked...Thanks

Option Compare Database

Global FilterFacility As String

Public Function GetFilterFacility() As Variant
  GetFilterFacility = FilterFacility
End Function
0
 
LVL 75

Expert Comment

by:DatabaseMX (Joe Anderson - Access MVP)
Comment Utility
Exactly!

So, what version of Access are you using?
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
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.

763 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

16 Experts available now in Live!

Get 1:1 Help Now