A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Formulat help please



 
 
Thread Tools Display Modes
  #1  
Old February 20th, 2006, 12:06 AM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Formulat help please

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

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...arted/200602/1
  #2  
Old February 20th, 2006, 12:17 AM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Formulat help please

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)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Tanya via AccessMonster.com" u15820@uwe wrote in message
news:5c22baaab99c0@uwe...
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

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...arted/200602/1



  #3  
Old February 20th, 2006, 12:21 AM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Formulat help please

Try .....

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

--
Ricky Hicks - Access MVP

"Tanya via AccessMonster.com" u15820@uwe wrote in message
news:5c22baaab99c0@uwe...
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

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...arted/200602/1



  #4  
Old February 20th, 2006, 12:54 AM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Formulat help please

Thanks that got it working.



Ricky Hicks [MVP] wrote:
Try .....

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

Hi,

[quoted text clipped - 10 lines]
State), 0)
Me.txtOrderTotal = curSum


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...arted/200602/1
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:44 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.