Count Zero or less

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a feild that I would like to count the 0 or less on the form header.
I know that if I would like to count all records it would be count (*). I
dont know what code to put in the ( ). The feild name is net.

Any help would be great. Thanks
 
2 examples:

Dcount("*","YourTable")

or

SELECT Count(*) FROM YourTable

So the * is a Blank and will choose the fastest field to perform this
agregate frunction.

- Raoul
 
Raoul,

I'm feeding the form with a Query "DEP_Vol_Numbers". I have this Query do
the following to give me the net feild.

Net: CDbl(Nz([Total Of DEPInDate],0))-CDbl(Nz([Total Of Loss FY],0))

So if no data is found then I get a 0 or it could be a negitive number. I
would like the text box to cound the 0 or less numbers.
 
this?

SELECT Count(*) FROM Dep_Vol_Numbers WHERE Net<=0

- RAoul

KAnoe said:
Raoul,

I'm feeding the form with a Query "DEP_Vol_Numbers". I have this Query do
the following to give me the net feild.

Net: CDbl(Nz([Total Of DEPInDate],0))-CDbl(Nz([Total Of Loss FY],0))

So if no data is found then I get a 0 or it could be a negitive number. I
would like the text box to cound the 0 or less numbers.



JaRa said:
2 examples:

Dcount("*","YourTable")

or

SELECT Count(*) FROM YourTable

So the * is a Blank and will choose the fastest field to perform this
agregate frunction.

- Raoul
 
KAnoe said:
I have a feild that I would like to count the 0 or less on the form
header. I know that if I would like to count all records it would be
count (*). I dont know what code to put in the ( ). The feild name is
net.

Any help would be great. Thanks

So [Net] is a field in the form's recordsource, and you want a text box
in the form header that counts the number of records for which [Net] is
<= 0? Try this as a controlsource expression for the text box:

=Abs(Sum([Net] <= 0))
 
Nice one Dirk :-)

- Raoul

Dirk Goldgar said:
KAnoe said:
I have a feild that I would like to count the 0 or less on the form
header. I know that if I would like to count all records it would be
count (*). I dont know what code to put in the ( ). The feild name is
net.

Any help would be great. Thanks

So [Net] is a field in the form's recordsource, and you want a text box
in the form header that counts the number of records for which [Net] is
<= 0? Try this as a controlsource expression for the text box:

=Abs(Sum([Net] <= 0))

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
KAnoe said:
Raoul,

I'm feeding the form with a Query "DEP_Vol_Numbers". I have this Query do
the following to give me the net feild.

Net: CDbl(Nz([Total Of DEPInDate],0))-CDbl(Nz([Total Of Loss FY],0))

So if no data is found then I get a 0 or it could be a negitive number. I
would like the text box to cound the 0 or less numbers.



:


2 examples:

Dcount("*","YourTable")

or

SELECT Count(*) FROM YourTable

So the * is a Blank and will choose the fastest field to perform this
agregate frunction.

- Raoul

:


Dim x as integer

x=Dcount("[Net]", "DEP_Vol_Numbers", "[Net] <1")

It makes no difference what you use in the first Parameter. You want to
count the number of records
that contain 0 or less in the Net field.

So, you could do something like:

x=Dcount("[Name of any field in your record]", "DEP_Vol_Numbers", "[Net]
< 1")

Ron
 
Back
Top