Re: Help needed with IF DSum in query
- From: John W. Vinson <jvinson@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 26 May 2007 17:33:16 -0600
On Sat, 26 May 2007 07:09:00 -0700, Holts Shoes
<HoltsShoes@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Hi
I wrote the following:-
=IF ([Size] Like[Enter Size] & "*"),
(DSum("[Quantity]","tblTransactions","[Incoming_Transaction]=TRUE")-DSum("[Quantity]","tblTransactions","[Outgoing_Transaction]=TRUE"))
But it came up with the follwing error:-
The expression you entered contains invald syntax, or you need to enclose
your text data in quotes.
Why do you think this error happens?
Thanks your being a great help
The function in Access is IIF(), not IF().
But... you have an expression which checks to see if the user's entery for
[Enter Size] matches the leftmost characters of the table field Size; if it
does, you sum ALL records in tblTransaction (regardless of size) for the two
fields and find the difference. I suspect that is NOT what you want to do!
Could you explain in words which records you want to sum? What's
tblTransactions related to - do you want the all Incoming transactions for a
given value of Size minus the sum of all outgoing transactions for that Size?
Why are you using LIKE: what are the values in Size? As written, if you have
sizes XS, S, M, L, XL, XXL and the user types X, you'll be summing all three X
sizes.
John W. Vinson [MVP]
.
- Prev by Date: RE: Problem filtering records using date
- Next by Date: Re: Date field and automaticl Sort field fill - solutions, ideas
- Previous by thread: RE: Problem filtering records using date
- Next by thread: Re: Help needed with IF DSum in query
- Index(es):
Relevant Pages
|