Re: Calculate certain number of records
- From: "Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx>
- Date: Sun, 16 Jul 2006 21:15:47 +0800
Since the value to be matcheds is text, I take it that MyField is a Text
field (not a Number field.)
Your 2nd exampls should work.
The * tells Access to count all fields where there is a match.
If it still fails, press Ctrl+G to open the Immediate window.
There type the expression an press enter:
? DCount("*", "MyTable")
That should give you the total number of records in the table.
Now try:
? DCount("*", "MyTable", "MyField = 'abc'")
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"john" <john@xxxxxxxx> wrote in message
news:78WdnTDbqOnCnSfZnZ2dnUVZ8qKdnZ2d@xxxxxxxxxxxx
Thanks, but I can't get it to work even after reading the explanation.
=DCount("*", "MyTable", "MyField = abc")
or
=DCount("*", "MyTable", "MyField = 'abc'")
are not accepted as an expression.
What does the * stand for in the expression, btw?
To make sure we're talking about the same thing. I want a field on my form
that has no relation with the current record. It should show the number of
records of the whole table where the value of MyField is abc.
john
"Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx> schreef in bericht
news:44b8b833$0$21733$5a62ac22@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
This kind of thing should work:
=DCount("*", "Table1", "ClientID = 99")
The arguments DCount() needs are the same as for DLookup(), so if you are
having difficulty supplying the 3rd one, see the explanation in this
article:
Getting a value from a table: DLookup()
at:
http://allenbrowne.com/casu-07.html
"john" <john@xxxxxxxx> wrote in message
news:aqSdneDWqZ99AiXZnZ2dnUVZ8s2dnZ2d@xxxxxxxxxxxx
I have a form with 1 table. I would like to create a field in my form
that shows the number of records (of the whole table) that have one
particular value. Is that possible? I fiddled with a calculated field but
I couldn't make it work.
Thanks in advance,
john
.
- Follow-Ups:
- Re: Calculate certain number of records
- From: john
- Re: Calculate certain number of records
- References:
- Calculate certain number of records
- From: john
- Re: Calculate certain number of records
- From: Allen Browne
- Re: Calculate certain number of records
- From: john
- Calculate certain number of records
- Prev by Date: Re: Passing fieldname to a subroutine
- Next by Date: Re: Passing fieldname to a subroutine
- Previous by thread: Re: Calculate certain number of records
- Next by thread: Re: Calculate certain number of records
- Index(es):
Relevant Pages
|
Loading