statements in a filter

A

Afrosheen

Thanks for reading my question.
I have a filter where it needs 1 criteria but it equals three other things.

This is the filter:

stwhere = "[shift] = 'B-Days' or [shift] = 'A-Days' or [shift] = 'Day
Shift' or [status] = 'Working'"

stDocName = "Rpt_Adays"
DoCmd.OpenReport stDocName, acViewPreview, , stwhere, ,

What I need is the field of [shift] to equal the "a-days', 'b-days', and
'day shift' and the field of [status] = to working.

When i do the report it displays;
Joe a-days working
Ted b-days off day
John day shift working
Mark b-days working.
Brian day shift off day

etc. The only problem is that it shows them as Off Day and any other
information. I need just those people working "Working"

Am I doing something wrong or am I going about it wrong?

Thanks
 
J

John Spencer

As I replied elsewhere all you need to do is to insert Parentheses and
change the last OR to AND to make this work.

stwhere = "([shift] = 'B-Days' or [shift] = 'A-Days' or [shift] = 'Day
Shift') AND [status] = 'Working'"

IF that does not work as you expect, please try to tell use why the
results are not what you want.

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 
A

Afrosheen

Thanks for the help John. It work perfectly.

John Spencer said:
As I replied elsewhere all you need to do is to insert Parentheses and
change the last OR to AND to make this work.

stwhere = "([shift] = 'B-Days' or [shift] = 'A-Days' or [shift] = 'Day
Shift') AND [status] = 'Working'"

IF that does not work as you expect, please try to tell use why the
results are not what you want.

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================

Thanks for reading my question.
I have a filter where it needs 1 criteria but it equals three other things.

This is the filter:

stwhere = "[shift] = 'B-Days' or [shift] = 'A-Days' or [shift] = 'Day
Shift' or [status] = 'Working'"

stDocName = "Rpt_Adays"
DoCmd.OpenReport stDocName, acViewPreview, , stwhere, ,

What I need is the field of [shift] to equal the "a-days', 'b-days', and
'day shift' and the field of [status] = to working.

When i do the report it displays;
Joe a-days working
Ted b-days off day
John day shift working
Mark b-days working.
Brian day shift off day

etc. The only problem is that it shows them as Off Day and any other
information. I need just those people working "Working"

Am I doing something wrong or am I going about it wrong?

Thanks
 

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

Similar Threads

statments in a filter 1
working with filters 6
filtering 2
Acc2010 - Filtering Report based on Subform Filter 3
how do you use a filter in programming 4
Excel 2 into 1 6
iif expression and time format 1
Multiple arguments 1

Top