Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Using a global variable as criteria in query grid

Posted on 2012-03-12
4
Medium Priority
?
387 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 - 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
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.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

963 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