G
Guest
On a form, how can I display how many "1"'s "2"'s or "3"'s are in a certain
field in a table?
tia
field in a table?
tia
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
On a form, how can I display how many "1"'s "2"'s or "3"'s are in a certain
field in a table?
tia
fredg said:On a form, how can I display how many "1"'s "2"'s or "3"'s are in a certain
field in a table?
tia
In the table? The value to be counted is the only data in the field,
i.e. 2, not 829?
=DCount("*","TableName","[FieldName] = 2")
If you mean something different, post back with more information and a
few examples of what you mean.
The table field holds data which shows which person is responsible for the
record; ie 1 is person A, 2 would be person B and so on.
I would like (on the form rather than in the table or query) a count of how
many 'A' has, how many 'B' has etc.
Thanks
fredg said:The table field holds data which shows which person is responsible for the
record; ie 1 is person A, 2 would be person B and so on.
I would like (on the form rather than in the table or query) a count of how
many 'A' has, how many 'B' has etc.
Thanks
That's what I gave you.
Add an unbound control to your form.
Set it's control source to:
=DCount("*","TableName","[FieldName] = 1")
Add another unbound control.
Set it's control source to:
=DCount("*","TableName","[FieldName] = 2")
..... etc... for the 3rd control.
Change TableName and FieldName to whatever the actual table and field
names are.
Look up DCount in VBA help.
Also look up, in VBA help,
Where clause + Restrict data to a subset of records.
Jock W said:Works a treat, Thanks.
Field was set to 'text' rather than 'numeric' which was why I couldn't get
it to work.
Thanks to all.
--
Jock Waddington
fredg said:The table field holds data which shows which person is responsible for the
record; ie 1 is person A, 2 would be person B and so on.
I would like (on the form rather than in the table or query) a count of how
many 'A' has, how many 'B' has etc.
Thanks
That's what I gave you.
Add an unbound control to your form.
Set it's control source to:
=DCount("*","TableName","[FieldName] = 1")
Add another unbound control.
Set it's control source to:
=DCount("*","TableName","[FieldName] = 2")
..... etc... for the 3rd control.
Change TableName and FieldName to whatever the actual table and field
names are.
Look up DCount in VBA help.
Also look up, in VBA help,
Where clause + Restrict data to a subset of records.
Jock W said:Found an issue now.
In a report which uses the same table to retreive data, there's a filter
thus:-
(qryJointWater.fldSanitising)="3" or ISNULL (qryJointWater.fldSanitising)
Since I have changed the data type from 'text' to 'numeric' the report
doesn't work; In fact I get an error message stating that there is a "Data
type mismatch in criteria expression"
Can I alter this expression to work with a numeric field?
--
Jock Waddington
Jock W said:Works a treat, Thanks.
Field was set to 'text' rather than 'numeric' which was why I couldn't get
it to work.
Thanks to all.
--
Jock Waddington
fredg said:On Fri, 16 Feb 2007 08:51:00 -0800, Jock W wrote:
The table field holds data which shows which person is responsible for the
record; ie 1 is person A, 2 would be person B and so on.
I would like (on the form rather than in the table or query) a count of how
many 'A' has, how many 'B' has etc.
Thanks
That's what I gave you.
Add an unbound control to your form.
Set it's control source to:
=DCount("*","TableName","[FieldName] = 1")
Add another unbound control.
Set it's control source to:
=DCount("*","TableName","[FieldName] = 2")
..... etc... for the 3rd control.
Change TableName and FieldName to whatever the actual table and field
names are.
Look up DCount in VBA help.
Also look up, in VBA help,
Where clause + Restrict data to a subset of records.
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.