Immediate IF

Chimp8471

Registered User.
Local time
Today, 16:01
Joined
Mar 18, 2003
Messages
353
IIF help please

I am trying to run a query, i have the following fields:

TimeCalled
Priority

the priority levels are :

0 - 10 mins
1 - 20 mins
2- 30 mins

what i am trying to do is create a query that says:

if priority is 0 then it will add 10 mins to my time called time:

i have written

IIF ([PriorityID],0,+10)

but this don't work
 
IIf([PriorityID]=0, [YourField]+10, [YourField])
 
i have typed this and it runs, but does not seem to add on the 10 mins, just displays my Time Called
 
You have a table, I take it, that is solely for priorities?

ie..

tblPriorities
PriorityID - autonumber
PriorityDescription - text
PriorityTime - number
 
Priority: IIf([PriorityID]=0, [PriorityTime] + 10, [PriorityTime])
 
it just doesn't seem to change the time in my query, i only get the original time
 

Attachments

For one thing, if you look in your Priority lookup table you will see that you do not have an entry of 0 for the PriorityID.

Changing the value to 1 in your query doesn't return the correct time but I can guarantee that you will never get anything other than the original time with it set to 0.
 
Change your calculated field in your query to:

Code:
TargetTime: IIf([PriorityID]=1,DateAdd("n",10,[Time Called]),[Time Called])
 
PriorityData: IIf(CInt(Left([Priority],1))=0,DateAdd("n",10,[Time Called]),[Time Called])


Your table is NOT what I said - I specifically made the response time field a number field because you need that to add the specific number of minutes. With Text saying "within 10 mins" there's nothing you can do. So, just change to a number field and put the number of minutes into it.

Also, in the query, you need to add the Priority table too. You can't do anything with just an ID field.

If the purpose is to add the number of minutes to each timescale then this can, with my suggested method, be accomplished with:

PriorityData: DateAdd("n",[Response Time],[Time Called])
 

Users who are viewing this thread

Back
Top Bottom