Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / March 2005

Tip: Looking for answers? Try searching our database.

Count Zero or less

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
KAnoe - 30 Mar 2005 11:45 GMT
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
JaRa - 30 Mar 2005 12:39 GMT
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

> 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
KAnoe - 30 Mar 2005 13:19 GMT
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:
>
[quoted text clipped - 14 lines]
> >
> > Any help would be great. Thanks
JaRa - 30 Mar 2005 14:03 GMT
this?

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

- RAoul

> Raoul,
>
[quoted text clipped - 24 lines]
> > >
> > > Any help would be great. Thanks
Ronald W. Roberts - 30 Mar 2005 22:10 GMT
>Raoul,
>
[quoted text clipped - 30 lines]
>>>
>>>      

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

Signature

Ronald W. Roberts
Roberts Communication
rwr@robcom.com

Dirk Goldgar - 30 Mar 2005 16:14 GMT
> 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))

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

JaRa - 30 Mar 2005 17:45 GMT
Nice one Dirk :-)

- Raoul

> > 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
[quoted text clipped - 8 lines]
>
>     =Abs(Sum([Net] <= 0))
Dirk Goldgar - 30 Mar 2005 17:51 GMT
> Nice one Dirk :-)
>
> - Raoul

Thanks, Raoul.  I don't remember who I stole that from.  Someone in the
newsgroups, I'm sure.

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.