Nz(DCount

  • Thread starter Thread starter Little Penny
  • Start date Start date
L

Little Penny

What is the proper syntax of this dcount statement

=Nz(DCount("OperatingSystem","Workstations")","("OperatingSystem = "Windows 2000","),0)

I want it to count all the Operating System in the Workstation table that are equal Windows 2000

If I can do this a and want to add a third criteria for instance PhysicalMemory less than 1024k
How would I do that?




Thanks
 
DCount("[OperatingSystem]","Workstations","[OperatingSystem] = 'Windows
2000'")

DCount("[OperatingSystem]","Workstations","[OperatingSystem] = 'Windows
2000' AND [PhysicalMemory] <1024")

AFAIK, the NZ function provides no useful purpose when using DCount,
although it does when using DLookup.

HTH,
 
I can't get this to work

I put this in the control source of a test box

DCount("[OperatingSystem]","Workstations","[OperatingSystem] = 'Windows 2000'")


I get this #Name? in the box
 
Preceded by an equal sign? OperatingSystem is the correct spelling of a
field in a table named Workstations?

--
George Nicholson

Remove 'Junk' from return address.


Little Penny said:
I can't get this to work

I put this in the control source of a test box

DCount("[OperatingSystem]","Workstations","[OperatingSystem] = 'Windows
2000'")


I get this #Name? in the box









DCount("[OperatingSystem]","Workstations","[OperatingSystem] = 'Windows
2000'")

DCount("[OperatingSystem]","Workstations","[OperatingSystem] = 'Windows
2000' AND [PhysicalMemory] <1024")

AFAIK, the NZ function provides no useful purpose when using DCount,
although it does when using DLookup.

HTH,
 
Put the "=" back in the front of the statement.

Little said:
I can't get this to work

I put this in the control source of a test box

DCount("[OperatingSystem]","Workstations","[OperatingSystem] = 'Windows 2000'")

I get this #Name? in the box
DCount("[OperatingSystem]","Workstations","[OperatingSystem] = 'Windows
2000'")
[quoted text clipped - 6 lines]
 
=DCount("[OperatingSystem]","Workstations","[OperatingSystem] = 'Windows 2000'")

Eric I get an error when I do this


Put the "=" back in the front of the statement.

Little said:
I can't get this to work

I put this in the control source of a test box

DCount("[OperatingSystem]","Workstations","[OperatingSystem] = 'Windows 2000'")

I get this #Name? in the box
DCount("[OperatingSystem]","Workstations","[OperatingSystem] = 'Windows
2000'")
[quoted text clipped - 6 lines]
 
Can you provide additional information?
Are you trying to use the DCount function in a macro, in code or form, or are
you trying to use the DCount function within a query?

If you are trying to use DCount in a query, you should switch to the Count
function using Totals.
If macro or form, then DCount is OK.

You must get the syntax of the statement correct in order for it to work
properly. This is not always easy, at first.
=DCount("[fieldyouwanttocount]", "Tablethatcontainsfieldyouwanttocount", "
[FieldToFilter] = ' FilterOnThis ' " )

To see if you have the first part correct, try:
=DCount("[OperatingSystem]", "Workstations")

This should give you the total number of records in you table - Workstations.
If you get the desired results here, you're better than half way home. If not,
you need to provide further information in order for someone to provide
addtional help. If this shortened statement works, add the Where clause. I
added spaces to this section so that you could see the single/double quotes
properly, you would not include these spaces.

I tested all of the above using a form and a textbox. If this is NOT what you
are doing, please clarify.



Little said:
=DCount("[OperatingSystem]","Workstations","[OperatingSystem] = 'Windows 2000'")

Eric I get an error when I do this
Put the "=" back in the front of the statement.
[quoted text clipped - 11 lines]
 
Another item:

Is [OperatingSystem] the best field for you to count? Could it ever be null?
If so, you won't get the corrrect count.
You can simplify the statement by the following:

=DCount( " * ", "YourTable", "[FieldToFilter] = ' FilterGoesHere ' " )
(again, I added spaces in " * " - for clarity. You shouldn't)

Hope that helps!

Little said:
=DCount("[OperatingSystem]","Workstations","[OperatingSystem] = 'Windows 2000'")

Eric I get an error when I do this
Put the "=" back in the front of the statement.
[quoted text clipped - 11 lines]
 
Back
Top