473,395 Members | 1,761 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Count field values

Is there any way to count the number of times a certain value appears
in a range of fields on one record. I have a table with 25 yes/no
fields in it and would like to count how many yes ticks there are.

Thanks for any help

Phil Kershaw

Nov 12 '05 #1
2 5888
Phil,
Yes/No Fields: Yes = -1 and No = 0
YourTotal: - (Fld1 + Fld2 + Fld3 ...)

--
Hope this helps
Arno R
"Phil Kershaw" <pm*@kershaw.eclipse.co.uk> schreef in bericht
news:3f**************@news.eclipse.co.uk...
Is there any way to count the number of times a certain value appears
in a range of fields on one record. I have a table with 25 yes/no
fields in it and would like to count how many yes ticks there are.

Thanks for any help

Phil Kershaw

Nov 12 '05 #2
On Wed, 26 Nov 2003 20:48:30 GMT, pm*@kershaw.eclipse.co.uk (Phil
Kershaw) wrote:
Is there any way to count the number of times a certain value appears
in a range of fields on one record. I have a table with 25 yes/no
fields in it and would like to count how many yes ticks there are.

Thanks for any help

Here is some aircode that might work for you.
----------------------------------
Private Function Yeses() As Integer
Dim str As String
Dim rst As DAO.Recordset
Dim db As DAO.Recordset
Dim fld As DAO.Field

str = "SELECT * FROM tblMyTable WHERE PK = Something"
Set db = CurrentDb
Set rst = db.OpenRecordset(str)
For Each fld In rst.Fields
If fld.Type = dbBoolean Then
If fld = True Then Yeses = Yeses + 1
End If
Next
Yeses = Abs(Yeses)
End Function
-----------------------------------

Change table name and PK (or ID) to the appropriate ones.

- Jim

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Cro | last post by:
Hello Access Developers, I'd like to know if it is possible to perform a count in an expression that defines a control source. My report is based on a query. In my report, I want a text box to...
3
by: Rabun | last post by:
Heres one that is giving me fits ( = = Access newbie), more than likely something simple that I blew right over . . . any help is appreciated - I have a report based on a query, with several...
4
by: Frank O'Neil via AccessMonster.com | last post by:
I have two forms. Form-1 has a combo box, the selection from the combo box populate form-2 Example form-1 Form- 2 Text1 Text2 Text3 Drop down contain text...
0
by: simonjackson500 | last post by:
I have a field as follows: aa_comp 03, 04, 05 03, 07, 05, 20 03, 06, 07 It is imported from xml (along with other fields), and I am aware of multiple values in a field is bad normalisation.
22
by: MP | last post by:
vb6,ado,mdb,win2k i pass the sql string to the .Execute method on the open connection to Table_Name(const) db table fwiw (the connection opened via class wrapper:) msConnString = "Data Source="...
1
by: jmarr02s | last post by:
I used the following query supplied by Jorn, SELECT IIf(=15 Or =19, "15 og 19",IIf(=13 Or =17,"13 og 17",IIf(=16 Or =20,"16 og 20",IIf(=14 Or =18,"14 og 18",IIf(=9, "9",...
5
by: Marshallp24 | last post by:
Hi, I need to be able to display a count of records in a message box but with a criteria of the just ones where there is a yes in a certain field. so the message box will pop up saying something...
2
by: Pete | last post by:
I need to create a single query (Not a SQL query) against a single table that counts the number of records in the table, where the single field "tmp" contains specific string values If the field...
5
by: Dean | last post by:
Hi, I have a table with non-unique identifiers. I need to take all the values with the same ID's and combine them into one field with a semicolon as a seperator. These values may exceed 255...
14
by: zufie | last post by:
I have to create a QA report regarding callers calling into a phone hotline. The report consists of many checkboxes such as: Did the IBCCP agency contact you? Yes/NO How many days passed...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.