Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old August 10th, 2006, 02:05 PM
BerkshireGuy
Guest
 
Posts: n/a
Default Help with nested IIF statement in a query

Hello all.

This expression is in my query and it works well. However, if both
continues are false, I want it to say "Not Yet Issued". I've added
that and getting an #ERROR.

Any ideas?

TimeToIssue: IIf(Not
IsNull([ApprovedStandardTransDate]),DateDiff("d",[REceivedTransdate],[ApprovedStandardTransDate]),IIf(Not
IsNull([ApprovedSubStandardTransDate]),DateDiff("d",[REceivedTransdate],[ApprovedSubStandardTransDate]),"Not
Yet Approved"))

  #2  
Old August 10th, 2006, 02:35 PM
BerkshireGuy
Guest
 
Posts: n/a
Default Re: Help with nested IIF statement in a query

Please also make note that:

TimeToIssue: IIf(Not
IsNull([ApprovedStandardTransDate]),DateDiff("d",[ReceivedTransdate],[ApprovedStandardTransDate]),"TEST")


works

And

TimeToIssue: IIf(Not
IsNull([ApprovedSubStandardTransDate]),DateDiff("d",[ReceivedTransdate],[Approved
SubStandardTransDate]),"TEST")

works

It's only when I try to nest them I get the #Error


BerkshireGuy wrote:
Quote:
Hello all.
>
This expression is in my query and it works well. However, if both
continues are false, I want it to say "Not Yet Issued". I've added
that and getting an #ERROR.
>
Any ideas?
>
TimeToIssue: IIf(Not
IsNull([ApprovedStandardTransDate]),DateDiff("d",[REceivedTransdate],[ApprovedStandardTransDate]),IIf(Not
IsNull([ApprovedSubStandardTransDate]),DateDiff("d",[REceivedTransdate],[ApprovedSubStandardTransDate]),"Not
Yet Approved"))
  #3  
Old August 10th, 2006, 02:35 PM
Allen Browne
Guest
 
Posts: n/a
Default Re: Help with nested IIF statement in a query

What data type do you want the TimeToIssue to be?

If you want to treat it like a number, then assigning text like "Not Yet
Approved" is going to foul it up. Better to leave it as Null, and then put
that into the text box where it will be displayed. For that result, try:
TimeToIssue: DateDiff("d",[REceivedTransdate],
Nz([ApprovedStandardTransDate], [ApprovedSubStandardTransDate])

If you don't care that is is treated as text (e.g. 2 sorts after 10), try:
TimeToIssue: Nz(DateDiff("d",[REceivedTransdate],
Nz([ApprovedStandardTransDate], [ApprovedSubStandardTransDate]), "Not Yet
Approved")

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"BerkshireGuy" <bdaoust@yahoo.comwrote in message
news:1155215241.112134.280440@m79g2000cwm.googlegr oups.com...
Quote:
Hello all.
>
This expression is in my query and it works well. However, if both
continues are false, I want it to say "Not Yet Issued". I've added
that and getting an #ERROR.
>
Any ideas?
>
TimeToIssue: IIf(Not
IsNull([ApprovedStandardTransDate]),DateDiff("d",[REceivedTransdate],[ApprovedStandardTransDate]),IIf(Not
IsNull([ApprovedSubStandardTransDate]),DateDiff("d",[REceivedTransdate],[ApprovedSubStandardTransDate]),"Not
Yet Approved"))

  #4  
Old August 10th, 2006, 02:45 PM
BerkshireGuy
Guest
 
Posts: n/a
Default Re: Help with nested IIF statement in a query

Allen,

Thank you. I tried your suggestion and it work. I appreciate your
quick response.

Have a great day,
Brian



Allen Browne wrote:
Quote:
What data type do you want the TimeToIssue to be?
>
If you want to treat it like a number, then assigning text like "Not Yet
Approved" is going to foul it up. Better to leave it as Null, and then put
that into the text box where it will be displayed. For that result, try:
TimeToIssue: DateDiff("d",[REceivedTransdate],
Nz([ApprovedStandardTransDate], [ApprovedSubStandardTransDate])
>
If you don't care that is is treated as text (e.g. 2 sorts after 10), try:
TimeToIssue: Nz(DateDiff("d",[REceivedTransdate],
Nz([ApprovedStandardTransDate], [ApprovedSubStandardTransDate]), "Not Yet
Approved")
>
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
>
"BerkshireGuy" <bdaoust@yahoo.comwrote in message
news:1155215241.112134.280440@m79g2000cwm.googlegr oups.com...
Quote:
Hello all.

This expression is in my query and it works well. However, if both
continues are false, I want it to say "Not Yet Issued". I've added
that and getting an #ERROR.

Any ideas?

TimeToIssue: IIf(Not
IsNull([ApprovedStandardTransDate]),DateDiff("d",[REceivedTransdate],[ApprovedStandardTransDate]),IIf(Not
IsNull([ApprovedSubStandardTransDate]),DateDiff("d",[REceivedTransdate],[ApprovedSubStandardTransDate]),"Not
Yet Approved"))
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles