Formulat help please

  • Thread starter Tanya via AccessMonster.com
  • Start date
T

Tanya via AccessMonster.com

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
 
D

Douglas J. Steele

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)
 
R

Ricky Hicks [MVP]

Try .....

curSum = Nz(DSum("[Total]", "[WIP_Report_Initial_b]", "Region = '" &
Me.State & "'"), 0)
 
Top