Dcount Problem

N

NotGood@All

I have a table name "Money" with a field named "returned" (yes/No). I'm
trying to count the lines where "returned" = "Yes". I'm using this code but
it gives me a -1.

xReturn: DCount("[returned]","money","[returned]")=Yes
 
B

boblarson

If it is a boolean field (Yes/No datatype) then it would be:

xReturn: DCount("[returned]","money","[returned]=Yes")

Or

xReturn: DCount("[returned]","money","[returned]=True")

--
Bob Larson

Tutorials at http://www.btabdevelopment.com

__________________________________
 
B

boblarson

Basically as an explanation, which I forgot to put in the last post, was that
you were essentially just providing the value of YES in your code because it
was outside of the DCount.
--
Bob Larson

Tutorials at http://www.btabdevelopment.com

__________________________________
 
L

Linq Adams via AccessMonster.com

Wrap the whole thing in Abs() This returns the absolute value (value
regardless of negative/positive) of a field/expression:

xReturn: Abs(DCount("[returned]","money","[returned]")=Yes)
 
B

boblarson

Linq -

I guess you missed that part of the criteria was outside of the DCount and
not inside where it needed to be. If they use Abs like you've shown it will
only return 1 ALWAYS and not the count anyway. :)
--
Bob Larson

Tutorials at http://www.btabdevelopment.com

__________________________________
 
L

Linq Adams via AccessMonster.com

Yes I did! Of course, when I posted my reply, your post pointing it out
hadn't appeared!

Which brings up a question I've been meaning to ask for a while. When I post
an answer, I always check it after it appears here. I posted my answer and
checked it. There was only the original post and my reply at that time.

I come back now and there's three replies between the original post and mine!
In this case, the posts are in chronological order, but I've seen the same
thing happen (just today, as a matter of fact) where not only have posts that
weren't there when I posted appeared between mine and the OP, but they were
timestamped AFTER mine, but appear before it!
 
B

boblarson

With the newsgroups there are timing issues around various servers. So it is
possible to post before somone but have it show up after theirs does. The
forums, for example AWF, has one server it deals with so that is spot on.
But the newsgroups are totally different in that.
--
Bob Larson

Free Tutorials and Samples at http://www.btabdevelopment.com

__________________________________
 

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