A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Joining IIF statements together



 
 
Thread Tools Display Modes
  #1  
Old December 22nd, 2009, 10:14 AM posted to microsoft.public.access.queries
Sue Compelling
external usenet poster
 
Posts: 131
Default Joining IIF statements together

Hi

I have the following two IIF statements which give the right results when
used separately but I need to join them together so Access is assessing all
conditions. I've tried multiple ways though come back with varied errors -
from syntax, commas, too many arguments etc ...

Is there actually a way I can join these?

=IIf([JobSubStatus]="Awaiting Appointment Advice" And
DCount([JobID],"QryInProgress","[JobID] = " &
[JobID])=1,Now()-[datereceived],[JobStatusDate]-[datereceived])

=IIf(IsNull([JobSubStatus]),Now()-[datereceived],IIf([jobsubstatus]="Awaiting
Customer" Or "Appointment
Scheduled",[jobstatusdate]-[datereceived],[JobStatusDate]-[dateappt]))


TIA ...

--
Sue Compelling
  #2  
Old December 22nd, 2009, 01:49 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Joining IIF statements together



=IIf(([JobSubStatus]="Awaiting Appointment Advice"
And DCount("*","QryInProgress","JobID=" & [JobID])=1)
OR IsNull(JobSubStatus)
, Date()-[datereceived]
,IIf([JobSubStatus] = "Awaiting Customer"
or [JobSubStatus]= "Appointment Scheduled"
,[JobStatusDate]-[datereceived],[JobStatusDate]-[dateappt]))


John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

Sue Compelling wrote:
Hi

I have the following two IIF statements which give the right results when
used separately but I need to join them together so Access is assessing all
conditions. I've tried multiple ways though come back with varied errors -
from syntax, commas, too many arguments etc ...

Is there actually a way I can join these?

=IIf([JobSubStatus]="Awaiting Appointment Advice" And
DCount([JobID],"QryInProgress","[JobID] = " &
[JobID])=1,Now()-[datereceived],[JobStatusDate]-[datereceived])

=IIf(IsNull([JobSubStatus]),Now()-[datereceived],IIf([jobsubstatus]="Awaiting
Customer" Or "Appointment
Scheduled",[jobstatusdate]-[datereceived],[JobStatusDate]-[dateappt]))


TIA ...

  #3  
Old December 23rd, 2009, 04:58 AM posted to microsoft.public.access.queries
Sue Compelling
external usenet poster
 
Posts: 131
Default Joining IIF statements together

Thanks so much John - it worked AND you showed me how I should make the
statement better - so I was able to add in some more logic.

Brilliant ...

Wildcard here - my "Notify me of replies" NEVER works. It used to though
stopped about 3 mths ago - anything different that you know of?
--
Sue Compelling


"John Spencer" wrote:



=IIf(([JobSubStatus]="Awaiting Appointment Advice"
And DCount("*","QryInProgress","JobID=" & [JobID])=1)
OR IsNull(JobSubStatus)
, Date()-[datereceived]
,IIf([JobSubStatus] = "Awaiting Customer"
or [JobSubStatus]= "Appointment Scheduled"
,[JobStatusDate]-[datereceived],[JobStatusDate]-[dateappt]))


John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

Sue Compelling wrote:
Hi

I have the following two IIF statements which give the right results when
used separately but I need to join them together so Access is assessing all
conditions. I've tried multiple ways though come back with varied errors -
from syntax, commas, too many arguments etc ...

Is there actually a way I can join these?

=IIf([JobSubStatus]="Awaiting Appointment Advice" And
DCount([JobID],"QryInProgress","[JobID] = " &
[JobID])=1,Now()-[datereceived],[JobStatusDate]-[datereceived])

=IIf(IsNull([JobSubStatus]),Now()-[datereceived],IIf([jobsubstatus]="Awaiting
Customer" Or "Appointment
Scheduled",[jobstatusdate]-[datereceived],[JobStatusDate]-[dateappt]))


TIA ...

.

 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:19 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.