Put 2 Where Conditions together?

J

jo

Can I put two Where Conditions in a macro together? If yes how?

Condition1: List Box
=IIf([Forms]![Print Gauge List Dialog]![Select Dept] Is
Null,"","[Department]=Forms![Print Gauge List Dialog]![Select Dept]")

Condition 2: Check Box
IIf([Forms]![Print Gauge List Dialog]![Not
Active]=True,[GaugeInfo]![NotInUse]=True,[GaugeInfo]![NotInUse]=False

First condtiion is for a list box where the user can select a Dept
2nd condition is if the user also select the check box.
I have these conditions in a group macro for a Print Option Dialog. but I
cannot seem to put the condition as one so that the macro reads both
conditions?
Does any one know how I can put the two conditions together please???
 
S

Steve Schapel

Jo,

Are you abel to give some more relevant information about what you are doing
please?

What are the Actions in the macro?

Are you talking about a Condition for the macro action(s) itself, or are you
talking about the Where Condition argument of an OpenFrom or OpenReport
action? (Either way, the syntax of the expressions you have given are
irregular.)

Anyway, at this stage it is unclear what you are trying to achieve, so some
more info please.

--
Steve Schapel, Microsoft Access MVP


jo said:
Can I put two Where Conditions in a macro together? If yes how?

Condition1: List Box
=IIf([Forms]![Print Gauge List Dialog]![Select Dept] Is
Null,"","[Department]=Forms![Print Gauge List Dialog]![Select Dept]")

Condition 2: Check Box
IIf([Forms]![Print Gauge List Dialog]![Not
Active]=True,[GaugeInfo]![NotInUse]=True,[GaugeInfo]![NotInUse]=False

First condtiion is for a list box where the user can select a Dept
2nd condition is if the user also select the check box.
I have these conditions in a group macro for a Print Option Dialog. but I
cannot seem to put the condition as one so that the macro reads both
conditions?
Does any one know how I can put the two conditions together please???



__________ Information from ESET Smart Security, version of virus signature database 4142 (20090609) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
J

jo

ok Steve shall try
Macro is attached to a Print dialog form which has a 2 options, Option 1
selects "All Depts" and Option 2 selects "By Dept". And a Check box has now
been added for "Inactive" gauges, the user can now select this check box.
Then user can select Print Preview Or Print Or Close.

1st Option to select All Depts.

Macro Name: Print Preview
Condition: [Report to Print]=1
Action: OpenReport
Where Condition: IIf([Forms]![Print Gauge List Dialog]![Not
Active]=True,[GaugeInfo]![NotInUse]=True,[GaugeInfo]![NotInUse]=False)
This works perfect!

2nd Option to "Select Dept".

Macro Name: Print Preview
Condition: [Report to Print] =2
Action: OpenReport
Where Condition: =IIf([Forms]![Print Gauge List Dialog]![Select Dept] Is
Null,"","[Department]=Forms![Print Gauge List Dialog]![Select Dept]")

This condition is to select the Dept chosen by the user, my problem is how
to get the conditon to ALSO do the same conditon that is in option 1???
thanks Jo
Steve Schapel said:
Jo,

Are you abel to give some more relevant information about what you are doing
please?

What are the Actions in the macro?

Are you talking about a Condition for the macro action(s) itself, or are you
talking about the Where Condition argument of an OpenFrom or OpenReport
action? (Either way, the syntax of the expressions you have given are
irregular.)

Anyway, at this stage it is unclear what you are trying to achieve, so some
more info please.

--
Steve Schapel, Microsoft Access MVP


jo said:
Can I put two Where Conditions in a macro together? If yes how?

Condition1: List Box
=IIf([Forms]![Print Gauge List Dialog]![Select Dept] Is
Null,"","[Department]=Forms![Print Gauge List Dialog]![Select Dept]")

Condition 2: Check Box
IIf([Forms]![Print Gauge List Dialog]![Not
Active]=True,[GaugeInfo]![NotInUse]=True,[GaugeInfo]![NotInUse]=False

First condtiion is for a list box where the user can select a Dept
2nd condition is if the user also select the check box.
I have these conditions in a group macro for a Print Option Dialog. but I
cannot seem to put the condition as one so that the macro reads both
conditions?
Does any one know how I can put the two conditions together please???



__________ Information from ESET Smart Security, version of virus signature database 4142 (20090609) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
S

Steve Schapel

Jo,

I would recommend that you use the Criteria of the query that the report is
based on to achieve this purpose, rather than the Where Condition argument
of the OpenReport macro action. Is there any reason why not?

--
Steve Schapel, Microsoft Access MVP


jo said:
ok Steve shall try
Macro is attached to a Print dialog form which has a 2 options, Option 1
selects "All Depts" and Option 2 selects "By Dept". And a Check box has
now
been added for "Inactive" gauges, the user can now select this check box.
Then user can select Print Preview Or Print Or Close.

1st Option to select All Depts.

Macro Name: Print Preview
Condition: [Report to Print]=1
Action: OpenReport
Where Condition: IIf([Forms]![Print Gauge List Dialog]![Not
Active]=True,[GaugeInfo]![NotInUse]=True,[GaugeInfo]![NotInUse]=False)
This works perfect!

2nd Option to "Select Dept".

Macro Name: Print Preview
Condition: [Report to Print] =2
Action: OpenReport
Where Condition: =IIf([Forms]![Print Gauge List Dialog]![Select Dept] Is
Null,"","[Department]=Forms![Print Gauge List Dialog]![Select Dept]")

This condition is to select the Dept chosen by the user, my problem is how
to get the conditon to ALSO do the same conditon that is in option 1???
thanks Jo



__________ Information from ESET Smart Security, version of virus signature database 4142 (20090609) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
J

jo

Hi Steve I tried to use the Criteria of the query using:
IIf([Forms]![Print Gauge List Dialog]![Not
Active]=True,[GaugeInfo]![NotInUse]=True,[GaugeInfo]![NotInUse]=False)
But the problem is when I dont select "Not Active" i get no records at all
when I should get some?? and when I select "Not Active" I get everything like
its not actually working??

Steve Schapel said:
Jo,

I would recommend that you use the Criteria of the query that the report is
based on to achieve this purpose, rather than the Where Condition argument
of the OpenReport macro action. Is there any reason why not?

--
Steve Schapel, Microsoft Access MVP


jo said:
ok Steve shall try
Macro is attached to a Print dialog form which has a 2 options, Option 1
selects "All Depts" and Option 2 selects "By Dept". And a Check box has
now
been added for "Inactive" gauges, the user can now select this check box.
Then user can select Print Preview Or Print Or Close.

1st Option to select All Depts.

Macro Name: Print Preview
Condition: [Report to Print]=1
Action: OpenReport
Where Condition: IIf([Forms]![Print Gauge List Dialog]![Not
Active]=True,[GaugeInfo]![NotInUse]=True,[GaugeInfo]![NotInUse]=False)
This works perfect!

2nd Option to "Select Dept".

Macro Name: Print Preview
Condition: [Report to Print] =2
Action: OpenReport
Where Condition: =IIf([Forms]![Print Gauge List Dialog]![Select Dept] Is
Null,"","[Department]=Forms![Print Gauge List Dialog]![Select Dept]")

This condition is to select the Dept chosen by the user, my problem is how
to get the conditon to ALSO do the same conditon that is in option 1???
thanks Jo



__________ Information from ESET Smart Security, version of virus signature database 4142 (20090609) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
S

Steve Schapel

Jo,

Try just putting this in the Criteria of the NotInUse field in the query:
[Forms]![Print Gauge List Dialog]![Not Active]

--
Steve Schapel, Microsoft Access MVP


jo said:
Hi Steve I tried to use the Criteria of the query using:
IIf([Forms]![Print Gauge List Dialog]![Not
Active]=True,[GaugeInfo]![NotInUse]=True,[GaugeInfo]![NotInUse]=False)
But the problem is when I dont select "Not Active" i get no records at all
when I should get some?? and when I select "Not Active" I get everything
like
its not actually working??



__________ Information from ESET Smart Security, version of virus signature database 4142 (20090609) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
J

jo

Hi Steve I done as you suggested but when I check the box it will show me
what is Not Active but when I dont check the box so that it will shows me
Active I get a blank report??? Sorry to be a pain but I have tried various
ways and will either work for one and not the other???
Help please
Jo

Steve Schapel said:
Jo,

Try just putting this in the Criteria of the NotInUse field in the query:
[Forms]![Print Gauge List Dialog]![Not Active]

--
Steve Schapel, Microsoft Access MVP


jo said:
Hi Steve I tried to use the Criteria of the query using:
IIf([Forms]![Print Gauge List Dialog]![Not
Active]=True,[GaugeInfo]![NotInUse]=True,[GaugeInfo]![NotInUse]=False)
But the problem is when I dont select "Not Active" i get no records at all
when I should get some?? and when I select "Not Active" I get everything
like
its not actually working??



__________ Information from ESET Smart Security, version of virus signature database 4142 (20090609) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
J

jo

Hi Steve I thought I would let know I have managed to get to work using the
following: I
If([Forms]![Print Gauge List Dialog]![Not Active]=True,True,False)
Thanks for you help
Jo
 

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