Welcome to dbFreaks.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

If Statements

 
   Database Help (Home) -> MS Access RSS
Next:  515545  
Author Message
k11ngy

External


Since: Oct 13, 2008
Posts: 5



(Msg. 1) Posted: Mon Oct 13, 2008 7:12 am
Post subject: If Statements
Archived from groups: microsoft>public>access (more info?)

I recently asked the question in Excel and received good reply

=IF(AND(OR(C2="Pass",C2="Exempt"),OR(D2="Pass",D2="Exempt")),"FULL AWARD","")

I was wondering if anyone knew the formula in Access? Tried several times
but to no avail
As above, I needed

if A1 and A2 =pass or Exempt, Full Award, else "" or Null? (Not sure which
one)?

Thanks for help

Regards

Steve

 >> Stay informed about: If Statements 
Back to top
Login to vote
nonsense

External


Since: Nov 04, 2004
Posts: 693



(Msg. 2) Posted: Mon Oct 13, 2008 8:10 am
Post subject: Re: If Statements [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Access is not a "spreadsheet on steroids", so the references to Excel
"cells" won't work in Access.

"How" depends on "what" ... what are the field names in Access?

Where are you trying to doing this? A form? A query? A table?

More info, please...

Regards

Jeff Boyce
Microsoft Office/Access MVP


"k11ngy" <k11ngy.DeleteThis@discussions.microsoft.com> wrote in message
news:FD23F52F-C5A7-45DF-8B74-B3D6AD490F71@microsoft.com...
>I recently asked the question in Excel and received good reply
>
> =IF(AND(OR(C2="Pass",C2="Exempt"),OR(D2="Pass",D2="Exempt")),"FULL
> AWARD","")
>
> I was wondering if anyone knew the formula in Access? Tried several times
> but to no avail
> As above, I needed
>
> if A1 and A2 =pass or Exempt, Full Award, else "" or Null? (Not sure which
> one)?
>
> Thanks for help
>
> Regards
>
> Steve

 >> Stay informed about: If Statements 
Back to top
Login to vote
k11ngy

External


Since: Oct 13, 2008
Posts: 5



(Msg. 3) Posted: Mon Oct 13, 2008 8:29 am
Post subject: Re: If Statements [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Yes, probably wasnt that clear

I have

[AON Level 1] [AON Level 2] either of these must be a Pass or Exempt

The 3rd field [AON Portfolio] must achieve a PASS and a pass or exemption
from any of the above to obtain full award (Else "")

Apologies for being vague

Kind regards

"Jeff Boyce" wrote:

> Access is not a "spreadsheet on steroids", so the references to Excel
> "cells" won't work in Access.
>
> "How" depends on "what" ... what are the field names in Access?
>
> Where are you trying to doing this? A form? A query? A table?
>
> More info, please...
>
> Regards
>
> Jeff Boyce
> Microsoft Office/Access MVP
>
>
> "k11ngy" <k11ngy.DeleteThis@discussions.microsoft.com> wrote in message
> news:FD23F52F-C5A7-45DF-8B74-B3D6AD490F71@microsoft.com...
> >I recently asked the question in Excel and received good reply
> >
> > =IF(AND(OR(C2="Pass",C2="Exempt"),OR(D2="Pass",D2="Exempt")),"FULL
> > AWARD","")
> >
> > I was wondering if anyone knew the formula in Access? Tried several times
> > but to no avail
> > As above, I needed
> >
> > if A1 and A2 =pass or Exempt, Full Award, else "" or Null? (Not sure which
> > one)?
> >
> > Thanks for help
> >
> > Regards
> >
> > Steve
>
>
>
 >> Stay informed about: If Statements 
Back to top
Login to vote
nonsense

External


Since: Nov 04, 2004
Posts: 693



(Msg. 4) Posted: Mon Oct 13, 2008 8:33 am
Post subject: Re: If Statements [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

?where

Regards

Jeff Boyce
Microsoft Office/Access MVP

"k11ngy" <k11ngy.TakeThisOut@discussions.microsoft.com> wrote in message
news:45AD73D9-DC23-4656-ABC3-FD6544D3DA13@microsoft.com...
> Yes, probably wasnt that clear
>
> I have
>
> [AON Level 1] [AON Level 2] either of these must be a Pass or Exempt
>
> The 3rd field [AON Portfolio] must achieve a PASS and a pass or exemption
> from any of the above to obtain full award (Else "")
>
> Apologies for being vague
>
> Kind regards
>
> "Jeff Boyce" wrote:
>
>> Access is not a "spreadsheet on steroids", so the references to Excel
>> "cells" won't work in Access.
>>
>> "How" depends on "what" ... what are the field names in Access?
>>
>> Where are you trying to doing this? A form? A query? A table?
>>
>> More info, please...
>>
>> Regards
>>
>> Jeff Boyce
>> Microsoft Office/Access MVP
>>
>>
>> "k11ngy" <k11ngy.TakeThisOut@discussions.microsoft.com> wrote in message
>> news:FD23F52F-C5A7-45DF-8B74-B3D6AD490F71@microsoft.com...
>> >I recently asked the question in Excel and received good reply
>> >
>> > =IF(AND(OR(C2="Pass",C2="Exempt"),OR(D2="Pass",D2="Exempt")),"FULL
>> > AWARD","")
>> >
>> > I was wondering if anyone knew the formula in Access? Tried several
>> > times
>> > but to no avail
>> > As above, I needed
>> >
>> > if A1 and A2 =pass or Exempt, Full Award, else "" or Null? (Not sure
>> > which
>> > one)?
>> >
>> > Thanks for help
>> >
>> > Regards
>> >
>> > Steve
>>
>>
>>
 >> Stay informed about: If Statements 
Back to top
Login to vote
Dirk Goldgar

External


Since: Jan 11, 2008
Posts: 205



(Msg. 5) Posted: Mon Oct 13, 2008 10:26 am
Post subject: Re: If Statements [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"k11ngy" <k11ngy.RemoveThis@discussions.microsoft.com> wrote in message
news:FD23F52F-C5A7-45DF-8B74-B3D6AD490F71@microsoft.com...
>I recently asked the question in Excel and received good reply
>
> =IF(AND(OR(C2="Pass",C2="Exempt"),OR(D2="Pass",D2="Exempt")),"FULL
> AWARD","")
>
> I was wondering if anyone knew the formula in Access? Tried several times
> but to no avail
> As above, I needed
>
> if A1 and A2 =pass or Exempt, Full Award, else "" or Null? (Not sure which
> one)?


Something along the lines of:

=IIf(([A1]="Pass" Or [A1]="Exempt") And ([A2]="Pass" Or [A2]="Exempt"),
"Full Award", "")

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 >> Stay informed about: If Statements 
Back to top
Login to vote
k11ngy

External


Since: Oct 13, 2008
Posts: 5



(Msg. 6) Posted: Mon Oct 13, 2008 10:26 am
Post subject: Re: If Statements [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thanks for help and it does work, thank you, can I ask another as people here
chucked another scenario at me

It would invlove 3 criteria

1. If [A1] or [A2] are pass or exempt and [A3]=Pass or exempt ""Full Award,
else ""

Hope you can help

Kind regards

Steve

"Dirk Goldgar" wrote:

> "k11ngy" <k11ngy RemoveThis @discussions.microsoft.com> wrote in message
> news:FD23F52F-C5A7-45DF-8B74-B3D6AD490F71@microsoft.com...
> >I recently asked the question in Excel and received good reply
> >
> > =IF(AND(OR(C2="Pass",C2="Exempt"),OR(D2="Pass",D2="Exempt")),"FULL
> > AWARD","")
> >
> > I was wondering if anyone knew the formula in Access? Tried several times
> > but to no avail
> > As above, I needed
> >
> > if A1 and A2 =pass or Exempt, Full Award, else "" or Null? (Not sure which
> > one)?
>
>
> Something along the lines of:
>
> =IIf(([A1]="Pass" Or [A1]="Exempt") And ([A2]="Pass" Or [A2]="Exempt"),
> "Full Award", "")
>
> --
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
>
> (please reply to the newsgroup)
>
>
 >> Stay informed about: If Statements 
Back to top
Login to vote
Dirk Goldgar

External


Since: Jan 11, 2008
Posts: 205



(Msg. 7) Posted: Mon Oct 13, 2008 11:57 am
Post subject: Re: If Statements [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"k11ngy" <k11ngy RemoveThis @discussions.microsoft.com> wrote in message
news:BAB86446-77C5-4C5C-815E-033E0FE77E99@microsoft.com...
> Thanks for help and it does work, thank you, can I ask another as people
> here
> chucked another scenario at me
>
> It would invlove 3 criteria
>
> 1. If [A1] or [A2] are pass or exempt and [A3]=Pass or exempt ""Full
> Award,
> else ""
>
> Hope you can help

Did you try to work it out yourself, based on the example already provided
and the help-file entry for the IIf function? We generally prefer to teach
people to fish. But ...

Let me restate the logic to see if I understand it:

IF (
([A1] = "Pass" OR [A1] = "Exempt")
OR
([A2] = "Pass" OR [A2] = "Exempt")
)
AND
([A3] = "Pass" OR [A3] = "Exempt")
THEN
return "Full Award"
ELSE
return ""

Is that correct? If so, I would first reorder the clauses so that the most
restrictive one comes first:

IF ([A3] = "Pass" OR [A3] = "Exempt")
AND
(
([A1] = "Pass" OR [A1] = "Exempt")
OR
([A2] = "Pass" OR [A2] = "Exempt")
)
THEN
return "Full Award"
ELSE
return ""

Then I'd reassemble them into proper sequence for an IIf expression:

=IIf([A3] = "Pass" OR [A3] = "Exempt") AND (([A1] = "Pass" OR [A1] =
"Exempt") OR ([A2] = "Pass" OR [A2] = "Exempt")), "Full Award", "")

That may be hard to read, since the line is very long and will have been
broken onto multiple lines arbitrarily by the newsreader. I'll restate it,
breaking onto multiple line at logical places:

=IIf([A3] = "Pass" OR [A3] = "Exempt")
AND (([A1] = "Pass" OR [A1] = "Exempt")
OR ([A2] = "Pass" OR [A2] = "Exempt")),
"Full Award",
"")

Note, though, that in most places you could write this, it must actually be
entered all on one line.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 >> Stay informed about: If Statements 
Back to top
Login to vote
k11ngy

External


Since: Oct 13, 2008
Posts: 5



(Msg. 8) Posted: Tue Oct 14, 2008 3:34 am
Post subject: Re: If Statements [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi

Thanks for info, I do use the help menus and evry other resource I can find
to try and work things out, need more practice I suppose. I can see the
logic in the formulas, think I have more problems with Brackets and order of
function.

The last one you gave me, I typed in ONE line as and expression and it
claims I have too many arguments?

I will keep tweeking it about to see if I can get it to work

Thanks

Steve

"Dirk Goldgar" wrote:

> "k11ngy" <k11ngy.DeleteThis@discussions.microsoft.com> wrote in message
> news:BAB86446-77C5-4C5C-815E-033E0FE77E99@microsoft.com...
> > Thanks for help and it does work, thank you, can I ask another as people
> > here
> > chucked another scenario at me
> >
> > It would invlove 3 criteria
> >
> > 1. If [A1] or [A2] are pass or exempt and [A3]=Pass or exempt ""Full
> > Award,
> > else ""
> >
> > Hope you can help
>
> Did you try to work it out yourself, based on the example already provided
> and the help-file entry for the IIf function? We generally prefer to teach
> people to fish. But ...
>
> Let me restate the logic to see if I understand it:
>
> IF (
> ([A1] = "Pass" OR [A1] = "Exempt")
> OR
> ([A2] = "Pass" OR [A2] = "Exempt")
> )
> AND
> ([A3] = "Pass" OR [A3] = "Exempt")
> THEN
> return "Full Award"
> ELSE
> return ""
>
> Is that correct? If so, I would first reorder the clauses so that the most
> restrictive one comes first:
>
> IF ([A3] = "Pass" OR [A3] = "Exempt")
> AND
> (
> ([A1] = "Pass" OR [A1] = "Exempt")
> OR
> ([A2] = "Pass" OR [A2] = "Exempt")
> )
> THEN
> return "Full Award"
> ELSE
> return ""
>
> Then I'd reassemble them into proper sequence for an IIf expression:
>
> =IIf([A3] = "Pass" OR [A3] = "Exempt") AND (([A1] = "Pass" OR [A1] =
> "Exempt") OR ([A2] = "Pass" OR [A2] = "Exempt")), "Full Award", "")
>
> That may be hard to read, since the line is very long and will have been
> broken onto multiple lines arbitrarily by the newsreader. I'll restate it,
> breaking onto multiple line at logical places:
>
> =IIf([A3] = "Pass" OR [A3] = "Exempt")
> AND (([A1] = "Pass" OR [A1] = "Exempt")
> OR ([A2] = "Pass" OR [A2] = "Exempt")),
> "Full Award",
> "")
>
> Note, though, that in most places you could write this, it must actually be
> entered all on one line.
>
> --
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
>
> (please reply to the newsgroup)
>
>
 >> Stay informed about: If Statements 
Back to top
Login to vote
k11ngy

External


Since: Oct 13, 2008
Posts: 5



(Msg. 9) Posted: Tue Oct 14, 2008 7:58 am
Post subject: Re: If Statements [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thanks so much for help everyone. After some tweeking, I did manage to get
it to work.

That led to:

I used the query for a report and created a count function =count([Results
AON])

It actually counted all the fields, even "Null Fields" I tried to set
criteria to "Not Null" but still shows Null Fields when query is run so not
sure how I combat that one? Will keep investigating

Thanks again

Steve

"Dirk Goldgar" wrote:

> "k11ngy" <k11ngy RemoveThis @discussions.microsoft.com> wrote in message
> news:BAB86446-77C5-4C5C-815E-033E0FE77E99@microsoft.com...
> > Thanks for help and it does work, thank you, can I ask another as people
> > here
> > chucked another scenario at me
> >
> > It would invlove 3 criteria
> >
> > 1. If [A1] or [A2] are pass or exempt and [A3]=Pass or exempt ""Full
> > Award,
> > else ""
> >
> > Hope you can help
>
> Did you try to work it out yourself, based on the example already provided
> and the help-file entry for the IIf function? We generally prefer to teach
> people to fish. But ...
>
> Let me restate the logic to see if I understand it:
>
> IF (
> ([A1] = "Pass" OR [A1] = "Exempt")
> OR
> ([A2] = "Pass" OR [A2] = "Exempt")
> )
> AND
> ([A3] = "Pass" OR [A3] = "Exempt")
> THEN
> return "Full Award"
> ELSE
> return ""
>
> Is that correct? If so, I would first reorder the clauses so that the most
> restrictive one comes first:
>
> IF ([A3] = "Pass" OR [A3] = "Exempt")
> AND
> (
> ([A1] = "Pass" OR [A1] = "Exempt")
> OR
> ([A2] = "Pass" OR [A2] = "Exempt")
> )
> THEN
> return "Full Award"
> ELSE
> return ""
>
> Then I'd reassemble them into proper sequence for an IIf expression:
>
> =IIf([A3] = "Pass" OR [A3] = "Exempt") AND (([A1] = "Pass" OR [A1] =
> "Exempt") OR ([A2] = "Pass" OR [A2] = "Exempt")), "Full Award", "")
>
> That may be hard to read, since the line is very long and will have been
> broken onto multiple lines arbitrarily by the newsreader. I'll restate it,
> breaking onto multiple line at logical places:
>
> =IIf([A3] = "Pass" OR [A3] = "Exempt")
> AND (([A1] = "Pass" OR [A1] = "Exempt")
> OR ([A2] = "Pass" OR [A2] = "Exempt")),
> "Full Award",
> "")
>
> Note, though, that in most places you could write this, it must actually be
> entered all on one line.
>
> --
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
>
> (please reply to the newsgroup)
>
>
 >> Stay informed about: If Statements 
Back to top
Login to vote
John W. Vinson

External


Since: Nov 16, 2007
Posts: 1518



(Msg. 10) Posted: Tue Oct 14, 2008 10:22 am
Post subject: Re: If Statements [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Tue, 14 Oct 2008 07:58:20 -0700, k11ngy <k11ngy.RemoveThis@discussions.microsoft.com>
wrote:

>Thanks so much for help everyone. After some tweeking, I did manage to get
>it to work.
>
>That led to:
>
>I used the query for a report and created a count function =count([Results
>AON])
>
>It actually counted all the fields, even "Null Fields" I tried to set
>criteria to "Not Null" but still shows Null Fields when query is run so not
>sure how I combat that one? Will keep investigating

Count doesn't count fields - it counts records. If the record is retrieved
it's a record; it makes no difference if some of the fields are NULL.

--

John W. Vinson [MVP]
 >> Stay informed about: If Statements 
Back to top
Login to vote
Dirk Goldgar

External


Since: Jan 11, 2008
Posts: 205



(Msg. 11) Posted: Tue Oct 14, 2008 9:23 pm
Post subject: Re: If Statements [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"k11ngy" <k11ngy.DeleteThis@discussions.microsoft.com> wrote in message
news:63BCD69D-630D-4B05-8950-AFD8F62514C3@microsoft.com...
>
> The last one you gave me, I typed in ONE line as and expression and it
> claims I have too many arguments?


Looks like I had my own problem with brackets on that one -- left off a
leading one. Try this:

=IIf(([A3]="Pass" Or [A3]="Exempt") And (([A1]="Pass" Or [A1]="Exempt")
Or ([A2]="Pass" Or [A2]="Exempt")),"Full Award","")


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 >> Stay informed about: If Statements 
Back to top
Login to vote
yjx

External


Since: Oct 15, 2008
Posts: 1



(Msg. 12) Posted: Wed Oct 15, 2008 5:26 am
Post subject: Re: If Statements [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

fhdchnbm,njghyyyd
"Dirk Goldgar" <dg.TakeThisOut@NOdataSPAMgnostics.com.invalid> 写入消息新闻:uP7TqSmLJHA.3080@TK2MSFTNGP06.phx.gbl...
> "k11ngy" <k11ngy.TakeThisOut@discussions.microsoft.com> wrote in message
> news:63BCD69D-630D-4B05-8950-AFD8F62514C3@microsoft.com...
>>
>> The last one you gave me, I typed in ONE line as and expression and it
>> claims I have too many arguments?
>
>
> Looks like I had my own problem with brackets on that one -- left off a
> leading one. Try this:
>
> =IIf(([A3]="Pass" Or [A3]="Exempt") And (([A1]="Pass" Or [A1]="Exempt")
> Or ([A2]="Pass" Or [A2]="Exempt")),"Full Award","")
>
>
> --
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
>
> (please reply to the newsgroup)
>
 >> Stay informed about: If Statements 
Back to top
Login to vote
Display posts from previous:   
   Database Help (Home) -> MS Access All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]