D
DS
I wrote a function but it returns zero. There are definitly records in the
table. Any suggestions on what I might be doing wrong?
Thanks
DS
Public Function SUBEX() As Currency
Dim NOEX As Currency
Dim DOLEX As Currency
Dim PCTEX As Currency
SUBEX = NOEX + DOLEX + PCTEX
End Function
Public Sub NOEX()
Dim NOEX As Currency
NOEX = Round(Nz(DSum("(CDQuantity*CDPrice)", "tblCheckDetailsTMP",
"CDCheckID = " & Forms!Form1!TxtCheckID & " AND CDDiscountDP = 0"), 0), 2)
End Sub
Public Sub DOLEX()
Dim DOLEX As Currency
DOLEX =
Round(Nz(DSum("(CDQuantity*CDPrice)*(1+[CDTaxRate])+CDDiscountAmount",
"tblCheckDetailsTMP", "CDCheckID = " & Forms!Form1!TxtCheckID & " AND
CDDiscountDP = 1 AND CDDiscountWhere ='A'"), 0), 2) _
+ Round(Nz(DSum("CDQuantity*(CDPrice + CDDiscountAmount)",
"tblCheckDetailsTMP", "CDCheckID = " & Forms!Form1!TxtCheckID & " AND
CDDiscountDP = 1 AND CDDiscountWhere ='B'"), 0), 2)
End Sub
Public Sub PCTEX()
Dim PCTEX As Currency
PCTEX =
Round(Nz(DSum("(CDQuantity*CDPrice)*(1+[CDTaxRate])*CDDiscountPercent",
"tblCheckDetailsTMP", "CDCheckID = " & Forms!Form1!TxtCheckID & " AND
CDDiscountDP = 1 AND CDDiscountWhere ='A'"), 0), 2) _
+ Round(Nz(DSum("(CDQuantity*CDPrice)*CDDiscountPercent",
"tblCheckDetailsTMP", "CDCheckID = " & Forms!Form1!TxtCheckID & " AND
CDDiscountDP = 1 AND CDDiscountWhere ='B'"), 0), 2)
End Sub
table. Any suggestions on what I might be doing wrong?
Thanks
DS
Public Function SUBEX() As Currency
Dim NOEX As Currency
Dim DOLEX As Currency
Dim PCTEX As Currency
SUBEX = NOEX + DOLEX + PCTEX
End Function
Public Sub NOEX()
Dim NOEX As Currency
NOEX = Round(Nz(DSum("(CDQuantity*CDPrice)", "tblCheckDetailsTMP",
"CDCheckID = " & Forms!Form1!TxtCheckID & " AND CDDiscountDP = 0"), 0), 2)
End Sub
Public Sub DOLEX()
Dim DOLEX As Currency
DOLEX =
Round(Nz(DSum("(CDQuantity*CDPrice)*(1+[CDTaxRate])+CDDiscountAmount",
"tblCheckDetailsTMP", "CDCheckID = " & Forms!Form1!TxtCheckID & " AND
CDDiscountDP = 1 AND CDDiscountWhere ='A'"), 0), 2) _
+ Round(Nz(DSum("CDQuantity*(CDPrice + CDDiscountAmount)",
"tblCheckDetailsTMP", "CDCheckID = " & Forms!Form1!TxtCheckID & " AND
CDDiscountDP = 1 AND CDDiscountWhere ='B'"), 0), 2)
End Sub
Public Sub PCTEX()
Dim PCTEX As Currency
PCTEX =
Round(Nz(DSum("(CDQuantity*CDPrice)*(1+[CDTaxRate])*CDDiscountPercent",
"tblCheckDetailsTMP", "CDCheckID = " & Forms!Form1!TxtCheckID & " AND
CDDiscountDP = 1 AND CDDiscountWhere ='A'"), 0), 2) _
+ Round(Nz(DSum("(CDQuantity*CDPrice)*CDDiscountPercent",
"tblCheckDetailsTMP", "CDCheckID = " & Forms!Form1!TxtCheckID & " AND
CDDiscountDP = 1 AND CDDiscountWhere ='B'"), 0), 2)
End Sub