DSum Syntax

  • Thread starter Thread starter DS
  • Start date Start date
D

DS

I have a DSum that is giving me problems. It says wrong synatx. Any
suggestions welcome.
Thanks
DS

Me.TxtRefAmount = Nz(DSum("PayAppliedAmount", "tblPayApplied",
"PayAppliedCheckID = " & Forms!frmFXRefunds!TxtCheckID & " And
PayAppliedNameID = " & Forms!frmFXRefundItems!TxtNameID & " And
PayAppliedAmount < 0 And PayAppliedTime = #" &
Forms!frmFXRefundItems!TxtTime & "#), 0)
 
Now it's saying Type Mismatch....I think I'm getting closer...
DS

Me.TxtRefAmount = Nz(DSum("PayAppliedAmount", "tblPayApplied",
"PayAppliedCheckID = " & Forms!frmFXRefunds!TxtCheckID & "" _
And "PayAppliedNameID = " & Forms!frmFXRefundItems!TxtNameID & " And
PayAppliedTime = #" & Forms!frmFXRefundItems!TxtTime & "# And
PayAppliedAmount <0"), 0)
 
Now it's saying Type Mismatch....I think I'm getting closer...
DS

Me.TxtRefAmount = Nz(DSum("PayAppliedAmount", "tblPayApplied",
"PayAppliedCheckID = " & Forms!frmFXRefunds!TxtCheckID & "" _
    And "PayAppliedNameID = " & Forms!frmFXRefundItems!TxtNameID & " And
PayAppliedTime = #" & Forms!frmFXRefundItems!TxtTime & "# And
PayAppliedAmount <0"), 0)

I removed a few of the excess double quotes...
Me.TxtRefAmount = Nz(DSum("PayAppliedAmount", "tblPayApplied",
"PayAppliedCheckID = " & Forms!frmFXRefunds!TxtCheckID & " _
And [PayAppliedNameID] =" & Forms!frmFXRefundItems!TxtNameID & "
And
PayAppliedTime = #" & Forms!frmFXRefundItems!TxtTime & "# And
PayAppliedAmount <0"), 0)
 
Back
Top