Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL statement help

Status
Not open for further replies.

mat41

Programmer
Mar 7, 2004
91
0
0
AU
Having toruble doing this in access 2003:

SELECT......., IIf([Days Opened]>[SLA Agreement],"Yes","No") AS [Has Meet SLA]
FROM tbleName.....

Specifically my issue is with:

IIf([Days Opened]>[SLA Agreement],"Yes","No") AS [Has Meet SLA]

I am getting an 'out of disk space in temp location error' I know I am not out of disk space. Does it matter if there are no values in some of the 'Days Opened' or 'SLA Agreement' fields? Any assitance getting this working while allowing empty field values would be great. NOTE they are both number data types.

TYIA
 
You could try wrapping [Days Opened] and [SLA Agreement] in the NZ function e.g.

[tt]
IIf(Nz([Days Opened],0)>Nz([SLA Agreement],0),"Yes","No") AS [Has Meet SLA]
[/tt]
 
Excellent that did it, thanking you very much. I am now using:

IIf(Nz([Days Opened],0)<=Nz([SLA Agreement],0),"Yes","No") AS [Has Meet SLA]

One more question if I may? How can I make sure if:

if Days Opened >= SLA Agreement say "Yes" (this is working)
if Days Opened > SLA Agreement say "No" (this is working)
If SLA Agreement does not have a value say "N/A"

TYIA

 
correction I should have said:

if Days Opened <= SLA Agreement say "Yes" (this is working)
if Days Opened > SLA Agreement say "No" (this is working)
If SLA Agreement does not have a value say "N/A
 
Replace "No" with another IIf ...
[tt]
, IIf(Nz(Days Opened], 0) > Nz([SLA Agreement], 0), "No", "N/A"))
[/tt]
 
I ended up getting this to work:

SWITCH
(
[Week Days Opened] <= TBL_SLA_Activity.[Number of Days] , 'YES',
[Week Days Opened] > TBL_SLA_Activity.[Number of Days] , 'NO',
TRUE, 'N/A'
) AS [Has Meet SLA]

Thank you so much for your time, very much appriciated!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top