can someone tell me where my formula going wrong V2

A

Alan

=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.
 
D

Douglas J. Steele

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')")
 
B

Bob Quintal

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top