2016-02-07 66 views
0

我需要從表中總結一筆金額。在沒有記錄存在的地方,我的函數必須返回零,但事實並非如此。我得到'#Error'。這裏是我的功能:計數記錄並返回零不存在

Public Function Fees() As Double 

Fees = Nz(DSum("MyFee", "tblDisclosure", "Volunteer = True And Not IsNull(ReceiptsLookup) and RequestDate> DateSerial(Year (Date),Month (Date),1)-1"), 0) 

End Function 

回答

1

嘗試用正確的條件字符串:

Public Function Fees() As Double 

    Fees = Nz(DSum("MyFee", "tblDisclosure", "Volunteer = True And Not IsNull(ReceiptsLookup) And RequestDate > DateSerial(Year(Date()), Month(Date()), 0)"), 0) 

End Function