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

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.
 
A

Allen Browne

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.
 
T

ThomasAJ

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top