Hi,
this works below for a numeric value but not for a text value. (Region is
text)
could someone please help with my syntax?
thanks
Dim curSum As Currency
curSum = Nz(DSum("[Total]", "[WIP_Report_Initial_b]", " 'Region' = " & Me.
State), 0)
Me.txtOrderTotal = curSum
Douglas J. Steele - 20 Feb 2006 00:17 GMT
You need to put quotes around the value if it's text:
curSum = Nz(DSum("[Total]", "[WIP_Report_Initial_b]", "Region = '" &
Me.State & "'"), 0)
or
curSum = Nz(DSum("[Total]", "[WIP_Report_Initial_b]", "Region = " &
Chr$(34) & Me.State & Chr$(34)), 0)
(BTW, there's no reason for the single quote around the field name)

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
> Hi,
>
[quoted text clipped - 10 lines]
> State), 0)
> Me.txtOrderTotal = curSum
Ricky Hicks [MVP] - 20 Feb 2006 00:21 GMT
Try .....
curSum = Nz(DSum("[Total]", "[WIP_Report_Initial_b]", "Region = '" &
Me.State & "'"), 0)

Signature
Ricky Hicks - Access MVP
> Hi,
>
[quoted text clipped - 10 lines]
> State), 0)
> Me.txtOrderTotal = curSum
Tanya - 20 Feb 2006 00:53 GMT
Thanks that got it working.
>Try .....
>
[quoted text clipped - 6 lines]
>> State), 0)
>> Me.txtOrderTotal = curSum