Using IIF IsNull In VB
Posted on 2005-05-13
I have a query that I need to produce all of the total values regardless of the Sum.
Here is my query, i used the IIf(IsNull) but for some reason when I send it to excel it is
just giving me the records with hours in it, whereas I need to see the zero's too. Can you please give
me any suggestions. Thanks in advance
SqlStat2 = "SELECT Project, Area, Component, IIf(IsNull(Sum(Hours)), 0, Sum(Hours)) AS TotalHours FROM TimeFile " _
& "WHERE (((Date) <= #" & enddate & "#)) " _
& "AND Project = '" & cboProject.Text & "'" _
& " AND Area = 'JACKET' " _
& "GROUP BY Project, Area, Component ORDER BY Component;"