Count Fields Within A Record

Jun 5, 2006

I'm building a health data system that stores data from health tests as follows:
[test01], [test02], [test03],.........[test25], etc etc.
Each of these tests comprised of a "Pass"/"Fail" value.

Now, i'm building my queries for a feedback report to hand over to the client that is based solely on the 1 single client record. In other words the queries are designed to return only 1 single data record to be placed in the client report where the based on the corresponding [TestID].

So within this 1 data record i want a query to count the number of times "Pass" appears in the test fields?

ie count([test01] [test02] [test03] [etc] [etc], ="Pass")

As there are some 40-50 [test##] fields in this one test battery i don'y particularly want to go back and code an IIf statement for each component if i can help it.

Many thanks in advance for any tips.

View Replies


ADVERTISEMENT

Customised Record Count Fields

Aug 1, 2005

Hey Guys,

I’ve attached a zipped example of the problem I am having with customised navigation buttons.

In my main database the form “subfrmPersonsContact” works perfectly. I have exported it to a new database and now the customised record count fields do not work at all – they are in fact blank even though the navigation buttons do still work.

The code running the form and the record count fields is listed below – I have no idea why it’s not working.

Any help would be greatly appreciated.

Cheers,

Rusty
:D


Private Sub Form_Current()
On Error GoTo err_Form_Current

Dim rs As Recordset
Dim Count As Integer, Position As Integer

Set rs = Me.RecordsetClone
rs.MoveLast
rs.MoveFirst

Count = rs.RecordCount
Me!txtRecCnt = "of " & Count

Position = Me.CurrentRecord
Me!txtRecPos = Position


If Position = 1 Then
Me!gotoPrevious.Enabled = False
Me!gotoFirst.Enabled = False
Else
Me!gotoPrevious.Enabled = True
Me!gotoFirst.Enabled = True
End If

If Position = Count Then
Me!gotoNext.Enabled = False
Me!gotoLast.Enabled = False
Me!txtRecCnt = "of " & Position
Else
Me!gotoNext.Enabled = True
Me!gotoLast.Enabled = True
Me!txtRecCnt = "of " & Count
End If

rs.Close

exit_Form_Current:
Exit Sub

err_Form_Current:
If Err.Number = 3021 Then
Resume Next
Else
Resume exit_Form_Current
End If
End Sub

View 1 Replies View Related

Queries :: Count How Many Fields Are Missing For Each Record

Jun 27, 2013

I have a fairly simple query to weed out all the records in our database that are missing vital pieces of infomation :

Code:
SELECT Contacts.Name, Contacts.Address1, Contacts.Address2, Contacts.Town, Contacts.County, Contacts.Country, Contacts.PostCode, Contacts.Telephone, Contacts.Code
FROM Contacts
WHERE (((Contacts.Address1) Is Null) OR ((Contacts.Address2) Is Null) OR ((Contacts.Town) Is Null) OR ((Contacts.County) Is Null));

Is there anyway to count how many fields are missing for each record ?

View 2 Replies View Related

Calculation Across Fields - Show Total Count For Each Record

Nov 14, 2014

I need a solution for the following problem:

For example:

............F1 F2 F3
Rec1 ....4 ..2 ..5
Rec2 ....3 ..3 ..1
Rec3 ....1 ..2 ..1

Now, I want to know how many 1s are there in Rec3 the answer is obviously 2 but I want a field(F4, for e.g) that calculates F1+F2+F3 showing all their 1s 2s and 3s.

A solution I found was...... F4=IIf([F1],1,0)+IIf([F2],1,0)+IIf([F3],1,0)

But I have over 50 Fields that contain 1s and 2s and I can't count them all by using this formula as it will be tremendously long and access will reject it.

So I need another formula(or function) that will look up for the 1s across multiple fields and show the total count for each record in a new field.

Tried 'look up' function but achieved nothing ....

View 3 Replies View Related

Queries :: Using Count And MIN Together To Retrieve Only MIN Record With Count

Aug 16, 2015

I have a table that has 5M+ accounting line entries. Below is an example of one accounting journal in the table.

BUSN_UNIT_IJRNL_DJRNL_ICNCY_CMONY_A
CB0014/07/20140002888269323AUD16797
CB0014/07/20140002888269323AUD-16797
CB0017/07/20140002888269323AUD16797
CB0017/07/20140002888269323AUD-16797

The journal ID above was an accounting entry, debit $16,797 and credit $-16,797. because it was entered as a reversing journal in the system, the table has captured the Journal ID with 2 dates. For my purpose i only want the one date (MIN) date, the total amount of the journal (either the debit or credit amount 16,797) and the total number of lines the journal ID has so in this instance I want the count to be 2 and not 4.

Right now this is what i get

BUSN_UNIT_I JRNL_I CNCY_C SumOfMONY_A CountOfJRNL_I MinOfJRNL_D
CB001 0002888269 AUD 0 4 4/07/2014

This is the output i would like

BUSN_UNIT_I JRNL_I CNCY_C SumofMONY_A CountofJRNL_I MinOfJRNL_D
CB0010002888269323 AUD16797 2 4/07/2014

Im thinking with the total sum because theres debits and credits is there a way to do the absolute value of the journal MONY_A then divide by 2?

current SQL
SELECT [One Year Data Lines].JRNL_I, [One Year Data Lines].CNCY_C, Count([One Year Data Lines].JRNL_I) AS CountOfJRNL_I, Min([One Year Data Lines].JRNL_D) AS MinOfJRNL_D, [One Year Data Lines].BUSN_UNIT_I, Sum([One Year Data Lines].MONY_A) AS SumOfMONY_A
FROM [One Year Data Lines]
GROUP BY [One Year Data Lines].JRNL_I, [One Year Data Lines].CNCY_C, [One Year Data Lines].BUSN_UNIT_I
HAVING ((([One Year Data Lines].JRNL_I)="0002888269") AND (([One Year Data Lines].CNCY_C)="aud"));

View 9 Replies View Related

Forms :: Total Query - Count Of Fields Based On Data In Other Fields

Jun 28, 2015

I have a query that creates counts of fields based on the data in other fields, basically it tells me that in a table there are two entries with value ABC????? and three of DEF????? , the query works perfectly.

When I create a form to display this data and base the form on the Query I keep getting a message box asking for the ID (key field) from the base table.

If I type * in the box (to denote all values) and press enter I get the results expected.

View 4 Replies View Related

Forms :: Record Count Last Visible Record Only?

Dec 16, 2014

I can use the following to return the last record count of the subform records, but I want the last record count of the VISIBLE records only.

So if records 1-15 are visible then it returns 15

If records 34-49 are visible then it returns 49

Code:
RecordsetClone.recordcount

View 14 Replies View Related

Count Number Of Fields Using Where

Oct 12, 2005

Hey,

I'm currently working on a database for my school project.

Currently, I have a table:

Job:
Contractor_ID [Foreign Key]
...

Contractors:
Contractor_ID [Primary Key]
Contractor [Text]

Basically I want to create a query that shows a table like so:
Wages:
Contractor [Contractors.Contractor]
Jobs_done [counts the number of rows from Job that has the Contractor_ID equal to the Contractor_ID specific to Contractor (above)]


Eg.


Job:
Contractor_ID
1
2
3
2
1
4

Contractors:
Contractor_ID Contractor
1 Bob
2 Bill
3 Jim
4 Jill

Wages:
Contractor Jobs_done
Bob 2
Bill 2
Jim 1
Jill 1

View 1 Replies View Related

Count Multiple Fields

Jun 26, 2006

hi there,

I have been struggling over this the past few days and get no where. I am trying to count the number of times Yes appears in a few fields. This is what I have right now in design view:

Field1YesCount: Count(IIF([Field1] = True,1,0))

Field2YesCount: Count(IIF([Field2] = True,1,0))

Field3YesCount: Count(IIF([Field3] = True,1,0))

This doesnt seem to work, could someone please help.

Thanks

View 2 Replies View Related

Count Multiple Fields

Jun 26, 2006

hi there,

I have been struggling over this the past few days and get no where. I am trying to count the number of times Yes appears in a few fields. This is what I have right now in design view:

Field1YesCount: Count(IIF([Field1] = True,1,0))

Field2YesCount: Count(IIF([Field2] = True,1,0))

Field3YesCount: Count(IIF([Field3] = True,1,0))

This doesnt seem to work, could someone please help.

Thanks

View 3 Replies View Related

How Do I Count Date Fields?

Jul 25, 2006

Hi there. Im trying to work out how I can count the dates in my database per month. What ive done is created an unbound box with an sql statement

SELECT Count([tbl Main].[Date of Call]) AS [CountOfDate of Call]
FROM [tbl Main]
HAVING (((Count([tbl Main].[Date of Call])) Between #4/1/2006# And #4/6/2006#));

When I select the totals button to count the records 0 are pulled out.

Does anyone know if im doing something wrong here. As always im sure its quite simple..

Cheers

View 7 Replies View Related

Retreive All Fields And Count

Oct 14, 2007

Hey all,

I'm having a hard time getting the output below from a query and was wondering if anyone would be able to reproduce this. Basically I'm trying to retrieve products that have more than 5 sales on a specific date and the retailers they sold at. I have the following simplified table.


Table name: SALES

PRODUCT RETAILER SALESDATE
---------------------------------------
PRODUCT1 COMPANY1 10/10/07
PRODUCT1 COMPANY2 10/10/07
PRODUCT2 COMPANY1 10/10/07


I am trying to find which products had more than two sales on the same date, and retrieve the product name, the retailer and the sales

I.E THE ABOVE TABLE WOULD PRODUCE


PRODUCT SALESDATE RETAILER
--------------------------------------
PRODUCT1 10/10/07 COMPANY1
PRODUCT1 10/10/07 COMPANY2



I've been able to only get the first two fields successfully by using


SELECT PRODUCT, SALESDATE
FROM SALES
GROUP BY SALESDATE, PRODUCT
HAVING (Count(PRODUCT)>=2);


MY problem is getting the retailers to appear also. Any help would be appreciated.

View 3 Replies View Related

Sorting Count Fields

Feb 1, 2006

How do you sort on a count field in a report

View 4 Replies View Related

Count For Week Ending.. In Different Fields

Jan 15, 2007

Morning All!

Boss-Man has a db (humongous) that (along with a zillion other things) tracks which specific tasks have been completed, who has done it and when did they do it.
All tasks will eventually be completed by all employees.

He's got a query that returns all of the dates on which each task has been completed, using each TASK name as a field.

The short version below shows the TASK1 was completed on 1/1/07, 2/7/06 and 2/17/07, TASK2 was completed on 01/05/07,by 2 people on 2/15/07 and again on 02/28/07 and so on.

TASK1***** TASK 2***** TASK 3 ***** TASK 4
1/1/2007 *** 1/5/2007*** 1/13/2007 *** 1/2/2007
2/7/2006 *** 2/15/2007 *** 1/7/2006 *** 1/15/2007
********** 2/15/2007
2/17/2007******
********** 2/28/2007 ********* 2/28/2006

What he would like to do is be able to show how many tasks were completed in any given week, such as:

WEEK ENDING # TASKS
01/06/07 3
01/13/07 1
02/17/07 2

Looks to me like you'd first have to identify the possible WeekEnding dates and then try to total across all the fields, but I've not got a clue how you'd do that.

Is there an easy way to "query the query", work with Week Ending on Saturday, and get the info he's looking for?

Thanks,
BeckieO

View 1 Replies View Related

Display Count Of Fields In Form.

Jul 21, 2006

Is it possible to have a count of all records matching a certain criteria displayed on the form?

I have to schedule customers for certain dates but never know how many have been scheduled by date while in the form. I am not sure how to reference the field from the table to be counted. I have several unbound boxes with:

=date()&" "&{XXXX}([SCHEDULE DATE]=date()
=date()+1&" "&{XXXX}([SCHEDULE DATE]=date()+1
=date()+2&" "&{XXXX}([SCHEDULE DATE]=date()+2
etc.

not sure what to use for {XXXX}

As always, any help is appreciated.....

Someday I will contribute some answers instead of questions.....

View 1 Replies View Related

Using DCount To Count Fields On Query

Jan 3, 2005

Good day:

Code:

=DCount("[DEPARTMENT]","[Query1]","[DEPARTMENT]='ENGINEERING'

I have a query with these fields: DIVISION, DEPARTMENT.

The DIVISION fields are populated with undergrad or grad. The DEPARTMENT fields are populated with ENGINEERING.

I wish to count the occurances of undergrad engineering and count the occurances of grad engineering and return the values in separate text boxes.

Any ideas on how to count occurances of TWO fields?

Thanking in advance.

Dee

View 2 Replies View Related

Reports :: Count Of Populated Fields

Apr 13, 2013

If I have a Report, with three fields (all data-type Text) named 'Jan', 'Feb' and 'Mar', and I want to have a fourth field (Unbound) alongside them, providing a count of the number of fields out of these three fields that are populated.

View 2 Replies View Related

Queries :: Query Count Difference Of Two Fields?

Jul 20, 2013

i have a access table (AUTH) with following field

Company Auth Held

Tata 12

Dell 11

HP 21

Opera 11

Bangour 10

i used the following query to calculate the Held from a table named pers.

SELECT AUTH.company, AUTH.Auth, Count(AUTH.company) AS Held
FROM pers INNER JOIN AUTH ON pers.company = AUTH.company
GROUP BY AUTH.company,AUTH.Auth

then i got the result as under

Company Auth Held

Tata 12 02

Dell 11 08

HP 21 20

Opera 11 12

Bangour 10 12

now i want the difference between Auth and Held as Sur/Defi

how can be it done.

View 2 Replies View Related

Modules & VBA :: Count Number Of Fields Have X As A Response

Nov 20, 2013

I have a form that records followup activities for protocols. The form allows the user to enter up to six f/u actions from a dropdown menu in six separate fields (called fu1_action, fu2_action, etc).

I am trying to write a query that retrieves only protocols that only have one f/u action selected as "telephone correspondence" and am having trouble. It seems I could write a function in VBA that would somehow loop through the 6 f/u action fields and give a value of 1 to those that have 'telephone correspondence' as a response, and then add them up to give a total of calls for that specific protocol, and then in a separate query only retrieve those that have a total number of calls = 1, but how to get started in writing this.

View 3 Replies View Related

General :: How To Count Fields With Records And Lock Them

Feb 11, 2014

I have a terrible skill in this but I am doing my best to find ways. But I am running out of time in the development stage. I have the following form and table:

Tables:
Eqpt
EqptHistory

Forms:
frmEqpt
frmHistory

frmEqpt is the Mother form and frmHistory is the subform connected thru eqptID. Now what I want to do is count the records in the frmHistory and Locked the fields for editing. If it is new records, the fields will automatically unlock.

How do I do that because I can't find a way to count the fields with records and lock them.

View 9 Replies View Related

General :: Count Fields Filled Out And Empty

Apr 29, 2014

a table which has several fields (ProjectID, Name, PM, Category, Date, Tester).

I am trying to find a way to count how many of the fields have been filled out and how many are null for a particular Project ID.

For example, ProjectID=27 has a Name and a PM but no more data so when I load the form I want the db to tell me 3 of the fields have been filled out for this project. This way I can calculate how many are empty (3 in this case)

How would I go about doing this

View 6 Replies View Related

Count Blank Fields Then Output Result To Form

Mar 18, 2007

Hi Have scoured the forum and have found people with a similar problem, but I just can't seem to get my head round this.

Basically I have a table with various fields, one of these fields is a sign off field where the user enters their name once the record has been reviewed.

I want to count all the records that do not have a name entered in this particular field thus are null/blank. I then want this figure to appear on a form thus representing the total number of records still to be reviewed.

I have tried doing this with various methods with no joy.

Any help would be much appreciated.

View 3 Replies View Related

Queries :: Unable To Count The Number Of Null Fields

May 16, 2013

I am trying to create a clean database and code to generate a report.

I am trying to count the number of null fields in one of my queries:

However, because of this expression, I cannot carry other fields with it. So the end result looks like:

But I would really like it to spit out the following information:

Total Not Fixed: 241
Department: Sustaining Eng

is there a way to create an SQL query to simply add data: I have tried the following:

Code:

ALTER TABLE qrySustainingEngNotFixed2 ADD Dept TEXT(25)
Insert Into qrySustainingEngNotFixed2 (Dept) Values (Sustaining Eng)
SELECT TotalNotFixed, Dept
FROM qrySustainingEngNotFixed2;

The above isn't working. Keep in mind that I want this is just for display purposes. I pondered making a custom table and then making a Union Query, but I'm trying to do this all in one SQL statement.

View 1 Replies View Related

How To Reset Count Of Auto Number Fields After Testing

Dec 12, 2012

I would like to know, how do i reset the count of my auto number fields after testing? is it also possible to specify which number the auto number should start counting from?

View 3 Replies View Related

Summary (Count) Of Multiple Date Fields By Month

Feb 13, 2014

What I have: A table with multiple Date/Time columns. Here's an example:

What I would like: A month-by-month summary counting the number of entries in each of the three columns, like this:

I'm indifferent as to what happens with the months zeros across all three fields (whether they show up in the report with zeros or are omitted altogether).

Smaller Pieces: I am able to create such a summary for one column at a time:

Not what I'm looking for: I can not figure out how to create a query that does this for all three columns. My best attempt was a disaster:

I have attached the example file for your convenience: Database1.accdb

To clarify, my issue isn't the format of the date. I know about the Month(...) function. My question is regarding how to count this data and split it into a month-by-month summary (see the picture above in the "What I would like:" section)

View 6 Replies View Related

Record Count?

Nov 1, 2005

Hey all, I was wondering if anyone might know how to obtain a reocrd count, I need to create a PERMIT number based on the number of records in my table. So I need the number of records in my table plus 1, which will then give me half of my permit number, I will then add the 2 last digits of the current year and add a "-" I think I have the date done, but I dont know how to obtain the number of records in my table? Can anyone help? Thanks

View 14 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved