Run or not run query

A

an

Hi!

I have a continuous form with Check Box named ExecProc.
This form has a command button with:

If Me!F_Proc!ExecProc = No Then
DoCmd.OpenForm "F_NoExecProc" 'alert form
Else
DoCmd.OpenQuery "Q_ExecProc" ' AppendQuery
Enf If

If all check boxes = No work fine and show us the alert form;
If only one check box = Yes, don't open the form and run Q_ExecProc.

I would like don't run the query if only one check box = No.

Thank you in advance.
an
 
J

Jeff Boyce

I suspect you will need to switch from a Continuous Form to a Single Form to
get that to work. You could still display multiple Single forms if you make
the window tall enough. Try it first as a Single Form...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
A

an

Ok, but the continuous form has many check boxes to confirm procedures.
With one form to each procedure...
Thanks.
an
 
J

Jeff Boyce

I'm not sure I understand...

You mentioned a single CheckBox in your original post.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
A

an

Sorry my delay.

In continuous form show us 'n' CheckBoxes.
One CheckBox to one procedure, Ok?

If all CheckBoxes = No work fine and show us the alert form.
But if only one CkeckBox = Yes then already don't show alert form.

I would like don't show the alert form only if all ChekBoxes = Yes

Thank you very much.
an
 
J

Jeff Boyce

One way might be to "count" the number of checkboxes that are checked.

Since the value of a Yes/No field (checkbox) is 0 for No and -1 for Yes (in
Access; in SQL-Server, I believe it is 1), you could add the fields to see
how many are checked. You could use a query and just add the fields
together... and if you use the Abs() function (absolute value) around the
summing expression, you'd get a positive number that shows how many are
checked.

You could use that number to decide whether to show the alert form.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Top