Link to home
Start Free TrialLog in
Avatar of starrynighter
starrynighter

asked on

Access 2000 query parameters (or variables?)

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 :
(Part.id)=[forms]![F0022]![flagGroup].[value]

Q3 has a where clause which includes a form variable comparison :
(Conn.Part1)=[Forms]![F0022]![currentID])

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)?
ASKER CERTIFIED SOLUTION
Avatar of shanesuebsahakarn
shanesuebsahakarn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of starrynighter
starrynighter

ASKER

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)"
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).
Good: that's pretty much what I need in designing forms which will run as multiple-instance.