Access 2000 query parameters (or variables?)

Posted on 2003-03-08
Medium Priority
Last Modified: 2006-11-17
In Access 2000 I have a list box for which the data source is “select . . .  from Q”
Q is a query which looks like “select . . .  from (Q1 left join Q2 on . . . ) left join Q3 on . . .  “

Q2 has a where clause which includes a form variable comparison :

Q3 has a where clause which includes a form variable comparison :

The list box in question is also on form F0022.

My list box works fine.

However, if I create another instance of the form with
“set frm2 as new Form_F0022”
my list box query in frm2 behaves according to the control values in the original F0022.

How can I code the query parameters to pick up the contextually appropriate values (i.e.: those in the form where the list box resides)?
Question by:starrynighter
  • 2
  • 2
LVL 41

Accepted Solution

shanesuebsahakarn earned 400 total points
ID: 8093743
I've not encountered this particular situation before, but does changing:


make a difference ?

Author Comment

ID: 8095118
Yeah, that works!
Please point me to on-line doc or web pages that describe "Form!control" - I haven't seen it before.

Actually I would prefer to pass parameters to the queries rather than referencing form variables, but Access SQL does not seem to permit this in the way that other SQLs allow eg:
"select * from viewname("string", 2)"
LVL 41

Expert Comment

ID: 8095156
Form, like Me is a property that returns a reference to the current form(or active form in this case), but unlike Me, can be used in controls.

You should be able to find the reference in the Access VBA Help file (type Form Property into the Answer Wizard).

Author Comment

ID: 8099000
Good: that's pretty much what I need in designing forms which will run as multiple-instance.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

I have had my own IT business for a very long time. I started mostly with hardware and after about a year started to notice a common theme. I had shelves with software boxes -- Peachtree, Quicken, Sage, Ouickbooks -- and yet most of my clients were…
When we develop an application in Ms Access 2016 we should also try to protect the queries, macros and table links. I know I may not have a permanent solution but for novice users, they will not manage to break your application. Below is the detail …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

621 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