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

MSAccess2000 - Dsum null value

Status
Not open for further replies.

44nato44

Programmer
Dec 12, 2008
115
0
0
NL
Hi

Jeg am using Dsum to sum values in a table which should be written back on the form

If it does not have a value or is null then it should write 0 (zero) to the form

I have tried dsum which does not work, I tried isnull, isempty, len to see if it would display null when its supposed to be null but it is not displaying anything. If it has a value it works fine.

I also have tried NZ and Cint(NZ(...,0) which also did not work.


DSum("[actvol]", "DBNAme", "[Maand] = " & Forms!frmDBAdmin!cboChooseMonthLoad.Value & " AND [TabelNo] = '" & varTableNo & "' AND [Jaar] = 2010)

Anybody has an idea ?
 
Are you saying this is not working?
NZ(DSum("[actvol]", "DBNAme", "[Maand] = " & Forms!frmDBAdmin!cboChooseMonthLoad.Value & " AND [TabelNo] = '" & varTableNo & "' AND [Jaar] = 2010,0)
 
Public Function getSum() As Integer
Dim varSum As Variant
varSum = DSum("[actvol]", "DBNAme", "[Maand] = " & Forms!frmDBAdmin!cboChooseMonthLoad.Value & " AND [TabelNo] = '" & varTableNo & "' AND [Jaar] = 2010")
If IsNumeric(varSum) Then
getSum = varSum
End If
End Function

Test your function first in the immediate window and supply it a value that returns a null. See if it works in the immediate window.
 
try
Code:
DSum("nz([actvol],0)", "DBNAme", "[Maand] = " & Forms!frmDBAdmin!cboChooseMonthLoad.Value & " AND [TabelNo] = '" & varTableNo & "' AND [Jaar] = 2010)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top