How to best run a conditional query from a multi-record form.

  • Thread starter Thread starter ThomasAJ
  • Start date Start date
T

ThomasAJ

1 Cleaner per record, button on each record, click it to show the Cleaner's
properties.

I have a Query run from a Macro (DoCmd.Action "Query"). In the Macro I have
set the Condition: [CleanerNumber]=[Forms]![Cleaners]![CleanerNumber]

The condition is being ignored.
 
The Condition in the macro designer is something that Access evaluates as
true or false, to decide whether to carry out the action or not. It's not
for filtering the query: it's for deciding whether to run the query or to
skip it.

In query design, you could put this in the Criteria row under your
CleanerNumber field:
[Forms]![Cleaners]![CleanerNumber]
This assumes that the Cleaners form is open, and has the desired cleaner
number in the current record.

Alternatively, you could create a form to show the results you want, and use
your expression in the WhereCondition of Openform.
 
Allen you are absolutely incredible!
--
Regards
Tom


Allen Browne said:
The Condition in the macro designer is something that Access evaluates as
true or false, to decide whether to carry out the action or not. It's not
for filtering the query: it's for deciding whether to run the query or to
skip it.

In query design, you could put this in the Criteria row under your
CleanerNumber field:
[Forms]![Cleaners]![CleanerNumber]
This assumes that the Cleaners form is open, and has the desired cleaner
number in the current record.

Alternatively, you could create a form to show the results you want, and use
your expression in the WhereCondition of Openform.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.


ThomasAJ said:
1 Cleaner per record, button on each record, click it to show the
Cleaner's
properties.

I have a Query run from a Macro (DoCmd.Action "Query"). In the Macro I
have
set the Condition: [CleanerNumber]=[Forms]![Cleaners]![CleanerNumber]

The condition is being ignored.
 
Back
Top