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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Showing Null values in a query

Status
Not open for further replies.

MarkNie

Technical User
Sep 22, 2005
102
GB
Hi All

Hope you are well!!

I am having a problem showing null values in the following query. I want to show the records which where signed off late and those that haven't been signed off at all up to todays date. Any help would be greatly appreciated..

I have tried inserting OR ((qrybAttn.Date) Is Null)) but then it shows all the records and not just up to today.

SQL Code

INSERT INTO ytblAttnIPSLAmissed ( PortfolioCode, RunDeadline, [Attn Date], [IP Date], [SLA Date] )
SELECT tblTracking.PortfolioCode, tblTracking.RunDeadline, qrybAttn.Date, qrybIP.Date, qrybSLA.Date
FROM ((tblTracking LEFT JOIN qrybAttn ON tblTracking.TrackingID = qrybAttn.TrackingID) LEFT JOIN qrybIP ON tblTracking.TrackingID = qrybIP.TrackingID) LEFT JOIN qrybSLA ON tblTracking.TrackingID = qrybSLA.TrackingID
WHERE (((tblTracking.RunDeadline)<Now()) AND ((Format([qrybAttn].[Date],"Short Date"))>Format([RunDeadline],"Short Date")))
WITH OWNERACCESS OPTION;

Thanks again.
Regards
Mark
 
There are several ways to do this. One is:
Code:
...((Format([b]nz([qrybAttn].[Date], Date(),[qrybAttn].[Date])[/b] ,"Short Date"))>Format...
although you can probably compare them without formatting to save some processing.

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Of course, i just read your other post, so keep the format.


Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Hi traingamer

When I enter your could in it give me an error as follows Wrong number of arguments used with function in query expression.

Here is the code any ideas??

INSERT INTO ytblAttnIPSLAmissed ( PortfolioCode, RunDeadline, [Attn Date], [IP Date], [SLA Date] )
SELECT tblTracking.PortfolioCode, tblTracking.RunDeadline, qrybAttn.Date, qrybIP.Date, qrybSLA.Date
FROM ((tblTracking LEFT JOIN qrybAttn ON tblTracking.TrackingID = qrybAttn.TrackingID) LEFT JOIN qrybIP ON tblTracking.TrackingID = qrybIP.TrackingID) LEFT JOIN qrybSLA ON tblTracking.TrackingID = qrybSLA.TrackingID
WHERE (((tblTracking.RunDeadline)<Now()) AND ((Format(nz([qrybAttn].[Date], Date(),[qrybAttn].[Date]) ,"Short Date"))>Format([RunDeadline],"Short Date")))
ORDER BY tblTracking.PortfolioCode
WITH OWNERACCESS OPTION;

Thanks
Regards
Mark
 
NZ takes only two arguments and you have
Code:
Format(nz([qrybAttn].[Date], Date(),[qrybAttn].[Date]) 
                 1             2          3
 
My mistake - I meant
Code:
...((Format(nz([qrybAttn].[Date], Date()) ,"Short Date"))>Format...
Confusing parameters of iif and nz. [blush]

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top