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 » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

can someone tell me where my formula going wrong V2



 
 
Thread Tools Display Modes
  #1  
Old May 24th, 2010, 12:33 PM posted to microsoft.public.access
Alan
external usenet poster
 
Posts: 459
Default can someone tell me where my formula going wrong V2

=DSum("[Amount6a6fs]","[Sales Analysis]","[Posting Date Period] = '" &
[cbMonth] & "' And [Revenue Stream Division] = 'Production' or [Revenue
Stream Division] = 'other' And ([Customer No] = 'C01317')")

every works apart from the last par customer no, the table name is correct
spelling,
the sun i'm getting is for everything not that specifc customer.

  #2  
Old May 24th, 2010, 01:17 PM posted to microsoft.public.access
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default can someone tell me where my formula going wrong V2

I suspect the problem is due to precedence of Or vs And.

Try using IN

=DSum("[Amount6a6fs]","[Sales Analysis]","[Posting Date Period] = '" &
[cbMonth] & "' And [Revenue Stream Division] IN ('Production', 'other')
And ([Customer No] = 'C01317')")

or put parentheses around the OR

=DSum("[Amount6a6fs]","[Sales Analysis]","[Posting Date Period] = '" &
[cbMonth] & "' And ([Revenue Stream Division] = 'Production' or [Revenue
Stream Division] = 'other') And ([Customer No] = 'C01317')")

--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/djsteele
Co-author: Access 2010 Solutions, published by Wiley
(no e-mails, please!)



"Alan" wrote in message
...
=DSum("[Amount6a6fs]","[Sales Analysis]","[Posting Date Period] = '" &
[cbMonth] & "' And [Revenue Stream Division] = 'Production' or [Revenue
Stream Division] = 'other' And ([Customer No] = 'C01317')")

every works apart from the last par customer no, the table name is correct
spelling,
the sun i'm getting is for everything not that specifc customer.


  #3  
Old May 28th, 2010, 11:08 PM posted to microsoft.public.access
Bob Quintal
external usenet poster
 
Posts: 939
Default can someone tell me where my formula going wrong V2

=?Utf-8?B?QWxhbg==?= wrote in
:

=DSum("[Amount6a6fs]","[Sales Analysis]","[Posting Date Period] =
'" & [cbMonth] & "' And [Revenue Stream Division] = 'Production'
or [Revenue Stream Division] = 'other' And ([Customer No] =
'C01317')")

every works apart from the last par customer no, the table name is
correct spelling,
the sun i'm getting is for everything not that specifc customer.



Parentheses are messed up. You have unnecessary ones around the
([Customer No] = 'C01317') but more importantly are missing a pair
around your two [Revenue Stream Division] = parameters.

Try
=DSum(
"[Amount6a6fs]",
"[Sales Analysis]",
"[Posting Date Period] = '" & [cbMonth] & "'
And
(
[Revenue Stream Division] = 'Production'
or [Revenue Stream Division] = 'other'
)
And [Customer No] = 'C01317'"
)

(all on 1 line, i've split it to show the grouping)
 




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 10:14 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.