can someone tell me where my formula going wrong V2

  • Thread starter Thread starter Alan
  • Start date Start date
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.
 
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')")
 
=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)
 
Back
Top