Handling Null in DSum

  • Thread starter Thread starter Anthony Viscomi
  • Start date Start date
A

Anthony Viscomi

What can I place in the following statement in order to make provisions for
Null?

Dim TotalDueX As Integer
TotalDueX = DSum("[Cost]", "[dbo_course]", "[SS] = '" & Me!SS & "'")

Thanks!
Anthony
 
Anthony

Dim TotalDueX As Integer
Dim iTemp as variant
iTemp= DSum("[Cost]", "[dbo_course]", "[SS] = '" & Me!SS & "'")
TotalDueX =iif(isnull(iTemp),0,iTemp)

The last line substitutes the value 0 if iTemp IS NULL (replace the 0 with
the desired default value)

Hope this helps

Chris
 
Great! Thanks
CJR said:
Anthony

Dim TotalDueX As Integer
Dim iTemp as variant
iTemp= DSum("[Cost]", "[dbo_course]", "[SS] = '" & Me!SS & "'")
TotalDueX =iif(isnull(iTemp),0,iTemp)

The last line substitutes the value 0 if iTemp IS NULL (replace the 0 with
the desired default value)

Hope this helps

Chris


Anthony Viscomi said:
What can I place in the following statement in order to make provisions
for Null?

Dim TotalDueX As Integer
TotalDueX = DSum("[Cost]", "[dbo_course]", "[SS] = '" & Me!SS & "'")

Thanks!
Anthony
 
Anthony,

TotalDueX = Nz(DSum("[Cost]", "[dbo_course]", "[SS] = '" & Me!SS & "'"),0)
 
Back
Top