The only way I know would be to have a reference Table/Query that enumerates all possible values of Months. Then modify your Query to build a sum grouping off of those reference values instead of what's in your table.
That way you'll end up with a sum of 0 on the months values that don't have any Records for them and your IIf statement should work.
Create a temp Table (tblMonths) with two fields in it:
MonthID - Primary Key, autonumber
MonthNo - Integer
Then, right before you run the query, run the following Code:
Code:
Dim rstTblMonth as Recordset
Dim nbrCurrMonth as Integer
Set rstTblMonth = CurrentDB().OpenRecordset("tblMonth", dbOpenDynaset)
' Empty out the temp Table
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE FROM tblMonth WHERE 1"
DoCmd.SetWarnings True
nbrCurrMonth = 0
' Add the previous 12 months to the table, including the current month
Do While nbrCurrMonth < 12
With rstTblMonth
.AddNew
' grab the month of today minus nbrCurrMonth months
!MonthNo = Month(DateAdd("m", -nbrCurrMonth,Date()))
.Update
End With
' increment our counter
nbrCurrMonth = nbrCurrMonth + 1
Loop
rstTblMonth.Close
Set rstTblMonth = Nothing