Counting Records In Report From Select Field
Aug 22, 2015there are 3 options Yes Somewhat and Not really I want to count the records that only have Yes.
View Repliesthere are 3 options Yes Somewhat and Not really I want to count the records that only have Yes.
View RepliesI'm creating a report for an imaginary "medical clinic's database", the intended function of which is described as follows: "Create a statistic that shows the total number of distinct drugs prescribed to a patient."
Where I'm at:
I've created a query called UniqueDrugs containing drug and patient info. The SQL is:
Quote:
SELECT DISTINCT Drugs.Drug_Name, Patients.[Patient _ID]
FROM Patients INNER JOIN (Drugs INNER JOIN Prescriptions ON Drugs.[Drug_ID] = Prescriptions.[Drug_ID]) ON Patients.[Patient _ID] = Prescriptions.[Patient_ID]
GROUP BY Drugs.Drug_Name, Patients.[Patient _ID]
ORDER BY Patients.[Patient _ID];
The results of this query seem to be what I need. All I need is for the count formula that I use to return the number of distinct drug names there are that are related to a patient's ID.
I've created a report and I've put the following formula into a text box:
=DCount("[Drug_Name]","[UniqueDrugs]","[Patient_ID]=[PID]")
Where PID is the name of another text box in the report that contains the Patient ID that I want to compare to the drug names returned by the query.
However, this *always* results in #Error, no matter how I change the formula.I have been led to believe that syntax is not the issue, as the following formula worked as intended for a different task:
=DCount("[Prescription_Date]","[UniqueYearQuery]","[Patient_ID]=[PID]")
How do I use a DCount to return the number of different drugs that have been prescribed to a patient?
If it did not require the number of different drugs, I would simply use the following formula, which works just fine:
=Count(Drug_Name)
I have been trying to create a report to count equipment tested between two dates:
I am using Access 2000 (old I know) and I have 21 different tables with the fields laid out the same. For the moment, I will list five of the tables: Servers, Laptops, Printers, Workstations, and Monitors. The criteria I draw from each table are the fields Model#, Part#, Serial#, Test Date, Retest Date, and Technician.
I can create a report from a query (say laptops). The criteria I is BETWEEN[Enter Start Date]AND[Enter End Date] under the TEST DATE field. Works great! In my report I use =Count(*)&" "&"Unit(s) tested" & "Between "&[Enter Start Date] & " and" & [Enter End Date].
That works great too.
I am trying to create ONE REPORT using ONE Date range and display how many units were tested:
Example:
Units Tested between March 1, 2014 and March 31, 2014
Servers 9
Laptops 23
Workstations 15
Printers 18
Monitors 31
If I can get these five tables, hopefully I can add additional tables to the same report as I need them. I am not savy with VB code, but will give it a go with some direction as to where to put it and how to add to it.
We have a shift log that includes both personnel actions during any given day as well as operational actions. (We recently switched from a word document to an Access Database to allow multiple users to input events while another has the logbook open already (which you couldn't do with Word))
At the beginning of each day, my manager reviews the previous days log and forwards up pertinent data (some personnel, some operational) to our higher authorities. Is there a way to allow him to select which records he'd like to include on that higher-authorities report straight from the local-level report?
I'm not a fan of allowing him a "Save As" feature because that kind of defeats the data integrity purpose of an events log where he could save as an RTF and then edit any of the log entries without any checks or balances.
I have a report which is based on a query. The query combines information from TBLDwgReg and TBLDwgRegDtls. The unique field linking these two tables is DrawingNo. The query - QRYDtldDwgReg - is showing 99% of the information I want to see.
My problem is this - one drawing can be revised several times. I have my report grouped by IssuedBy and then grouped by DrawingNo. In the group footer for IssuedBy I want to count the number of drawings issued by a particular consultant. For example...the structural engineer has issued 17 drawings for a particular project but when I do a count it is returning a total 27 because some of those drawings have been revised.
I tried grouping in the query and counting the DrawingNo field there but that's not working either.
hi there
I'm building a forum from the scrath. It is already working, but I want to have in each topic the number of replies it has.
there are 2 tables, one for the topics and other to the replies. in the replies table there is a field called id_post that has the id of the post witch it belongs.
I solve the problem by inserting a query inside the loop of the posts:
<%
While Not rs.EOF
%>
<%
Set rs2 = Server.CreateObject("ADODB.Recordset")
sql = "SELECT COUNT(*) as cont FROM replies where id_post= " & rs("id") & " "
rs2.Open sql,Conn,1,2
%>
post: <%=rs("post")%> replies:<%=rs2("cont")%>
<%
rs.MoveNext
wend
rs.close%>
but someone told that this would make the page slower, so I want to know if I can do the same thing without having the query inside the loop.
I don't know if I made myself clear, sorry for that.
tks for the help.
I have a master table located on the backend of the server with about 3 fields:
Software
Version
Description
I have 4 databases, one for each software on the front end accessing this master table.
So far I have in the master table a dropdown to select 1 of the 4 software's, the version number and a brief description.
One the front end I have a button that when pressed will bring up the report based on the master table.
Can I have the report just select the software that it refers to. For instance if the datebase is Sony when I click on the report it only grabs the records with Sony on it. For my next database when I open up Sharp's database it only makes a report for the Sharp records.
How would I do this? Is this something I have to code or something I can do in criteria or do I create a query?
For the report in question all data is taken from one table named "Completions ". The fields I will be using are as follows:
Code:
[Surname]
[Firstname]
[Branch]
[Quarter1_A]
[Quarter1_T]
When the records are added, the Branch is added using a combo box. There can be several rows of data with the same Firstname and Surname but with different Branches.The report layout must look something like this.I have tried using DLookup to select the data based on the data in the Name text box, but this just gets the first result and duplicates it.
I have a report due the first of each week in which I need the cases open and cases closed for the previous week, the week two weeks prior and the 2007 and 2006 year to date on two different types of cases. I have a case management table with a field for Type of Case, date assigned and date closed that I uses in my queries. Presently I have two query, one that generates only Type 1 cases from the Case Management Table and another for Type 2. I then use the Type 1 Query in another query that limits the results for Type 1 cases to those opened last week, one for those open two weeks ago, one for 2006 YTD and one for 2007 YTD. In these 4 queries I have one field [Type of Cases] and I have the query count. I then do this for Type 2 cases and then go through the whole process to do Closed Cases. All my queries have criteria to automatically filter the dates to the time periods mentioned above. I then have one report query that I put all the number in for my report. This query has 16 fields with the numbers for each period, last week open and closed, 2 weeks open and closed, etc. I then generated a report that takes these numbers from my report query and puts it in a report format automatically. As you can imagine this takes some time to go through each query to generate these numbers, so I was wondering how I may do this differently. Also, I have experienced a problem when a field produces no records I get a blank sceen with nothing under the Count of column and get the same thing for my report. How can I fix this.
View 1 Replies View RelatedHi all,
I have a table which contains business details (name, address etc) and also a field for clients. I then have a table which contains client details. Is there anyway I can click a button on a form containing business details which brings up a form containing the clients which would allow me to click the clients I want to be inserted onto the clients field on the business details table?
Does anybody have an example of this.
Thanks for your help!
I've tried the following WHERE clause to return records where the 'costper' field is empty and neither return any results.
WHERE NZ([Transactions].[CostPer])=0
WHERE [Transactions].[CostPer]=0
WHERE IsNull([Transactions].[CostPer])
Hello,
I have a dataset that consists of Stands within a forest inventory. There are two Fields: the first field is StandValue (dollars), the other field is the StandArea( hectares).
I want to select the highest valued stands BUT the sum of the individual areas found in "standArea" cant exceed 10,000 hectares. Can anyone help me figure out an SQL query for this, or any other suggestions on how to proceed would be greatly appreciated, thanks
Greg
Hello,
I've looked through the thread and was unable to find exactly what I'm looking for ?
Basically I have a table with multiple fields & records and I would like to key on the ID field which has a slew of different ID's..... these ID's can be the same & show up on the table anywhere from 1 to 600 times.
What I'm trying to do is select each ID and pull only 10 records for each or if less than 10 pull in those as well.
So instead of pulling in the 600 records for that particular ID I only want to pull in 10 of those records, and for the ID that only has the 1 record pull in the info for that as well.
Any help would be greatly appreciated.
Thank you
I can not solve this problem, my Access knoledge is mediocre.
I have the following table from imported data:
RecNr IPaddres DateandTime
1 178.00.000.01 20-11-2013 21:47:21
2 178.00.000.01 20-11-2013 21:47:59
3 178.00.000.01 20-11-2013 21:48:35
4 178.00.000.01 22-11-2013 20:44:59
5 178.00.000.02 22-12-2013 19:47:59
6 178.00.000.02 22-12-2013 20:47:59
7 178.00.000.03 01-02-2014 12:47:59
8 178.00.000.03 01-02-2014 12:48:30
9 178.00.000.03 01-03-2014 11:47:59
etc
I want to make a query that results in displaying records that have the same IP-address where the difference in the date/time stamp is within 1 minute. When the date/time stamp is > 1 minute the record can be deleted from the table.
I have a database for collecting evaluation responses for training. There are 20 questions, with a combo box for each with responses: agree, strongly agree, neutral, disagree, strongly disagree, n/a. I want to create a report that counts the number of responses for each question from a session. I don't know how to put a calculation field in a report to count the various responses and am not a programmer. Can someone help me.
Thanks.
Okay feel free to stamp "stupid" on my forehead if you want. I've read through all the threads I can before going cross eyed here and nothing I've tried works so far.
I'm creating yet another report from a query or table (both have the same data). I have a table with termed employee data including rate, attendance, efficiency and quality. The query I have has IIf statements for each of these, saying 1=Below, 2=Meets, 3=Exceeds and else is N/A. The table just shows the number value.
I need the report to count how many belows, meets, exceeds, and N/A each field has, and give a percent of the total. I tried copy and pasting some DLOOKUP codes but just got either an #ERROR or a 0. Any ideas?
When entering information on the form, there is a combo box with 4 options
Started
In Progress
Verified
Complete
There are several different areas on site here and i'd like to be able to set up a report which will count the amount of the above 4 possibilities for each section. For example i'd like the report to look something like below
Area A
Started 1
In Progress 6
Verified 3
Complete 5
Area B
Started 3
In Progress 9
Verified 21
Complete 11
So i'm displaying the number of jobs in each section and how far along they are at a glance
I have a group of inspectors who are assigned a group of buildings. I want to show a count of how many each inspector has. The end result should look like this:
Jones FSL 0: 0 FSL 1: 0 FSL 2: 1 FSL 3: 2 FSL 4: 2 Total: 5
Smith FSL 0: 0 FSL 1: 1 FSL 2: 2 FSL 3: 2 FSL 4: 1 Total: 6
White FSL 0: 1 FSL 1: 3 FSl 2: 0 FSL 3: 0 FSl 4: 0 Total: 4
First of all, we have a database for all company customer cases (through out the whole year of 2006). Every case has its own priority level.
‘Priority’ column has three option, ‘High’, ‘Medium’, and ‘Low’.
We are new to Access, and we are trying group all the case month to month (group them by their created date) on separate pages. At the end of each monthly summary, we’d like to do a number count on ‘High’, ‘Medium’, and ‘Low’.
Here is a sample that we are trying to get to…
Sample Datebase,
Case #// Created Date// Priority Level
001 12/5/06 High
002 12/7/06 Low
003 12/3/06 High
004 12/1/06 Medium
005 11/9/06 Medium
Sample Report we are trying to get to...
Summary for December:
Case #// Created Date// Priority Level
001 12/5/06 High
002 12/7/06 Low
003 12/3/06 High
004 12/1/06 Medium
Total Case: 4
High Priority Case: 2
Medium Priority Case: 1
Low Priority Case: 1
your help will be very appreciated! :rolleyes:
I have a report, where some features are listed as checkboxes. I'd like to have all checked checkboxes counted at the end of report. I've created text field. What shuold be the command in it ? (to count only checked boxes).
Thanx for any help
I have a form with 7 List boxes linked to 7 Query's which in turn are linked to a table. Each list box if for a particular trade.
I am trying to select a person or persons from each List box and then have them sent to a report. I have Code to do one list box, but do not know how to link all boxes with code to a 'Open report' button.
The code I am using is as follows:-
Private Sub cmdOpenReport_Click()
On Error GoTo Err_cmdOpenReport_Click
Dim strWhere As String
Dim ctl As Control
Dim varItem As Variant
'make sure a selection has been made
[code]....
Hi,
I wonder if someone could possibly help me.
I'm working on a database used to dispatch first aiders to events. The general structure is a form detailing the event with a subform (currently pulling info straight from a join table though I may change the data source to a query at a later date) containing details of attendees in list format.
I have a record in the events form that shows the number of first aiders attending which is currently updated manually. In the subform however, there is a tick box as to whether they attended as sometimes they enlist but have to cancel for whatever reason.
I wanted to implement something that will count the ticks and update the number attended field automatically.
I don't know alot about VB and have tried using the count expression function in the subform footer then setting the number attended field to equal the count field. The problem I find with this though is firstly there can sometime be a delay in updating this and secondly I need the number attended to appear in a report listing all the duties attended each month for expense claims.
I may be half way to hitting the mark with what I've tried but if anyone could suggest anything, I'd be very grateful.
Thanks in advance for the help
Ian
Quick overview. I have a site # and Subject #. The subject # is 7 digits and the first 4 are the site # (exp. Site # 1000, Subject # 1000001, 1000002, etc). At times the subjects switch sites but their subject # remains the same so Subject # 1000001 now resides at site # 2000.
How would I write a query like the following?
Count [tbl_Enrollment]![Subject #] WHERE [first 4 digits of the subject #] LIKE [tbl_Site_Dem]![Site #]
I have a student with an access table that has fields names week1, week2 etc. The data in these fields is either a '1' - meaning present or a '0' meaning absent. We want to be able to put a formula in a query that counts how many absences there have been (similar to a =countif formula in excel)
any ideas?
Hello everyone,
Got another problem that I'm sure you guys will solve with your eyes closed ;)
I've got a database with a field called courier_no. Imagine this set of data.
1234
1234
1266
1277
1277
1288
1299
I want to run a query to count the number of instances that each number appears. For example I would expect the results
1234 2
1266 1
1277 2
1288 1
1299 1
I then want to run a criteria on the count field (But I think I'm ok with that bit once I've solved the counting of the data.)
I've tried the count function in the query builder but it doesnt total the instances that each record appears.
Help please (and please keep it simple cos you know I struggle with all that VBA stuff :D)
Stu
hi all...
i'm sure there is a simple soultion to what i want to do but my brain isn't helping me at the moment...
i have a table called bookings with a column called nono which consists of dates with each date being a booking for a bed....
i want to be able to run a report for instance which tells me how many beds have been booked between two dates and year to date...
how do i go about doing this the most efficient way.... i can get a count for one particular date without a problem... and i know i could go and write out totals for each date in the range and then add them up...
however, is there a better more effieicient way of doing this???
cheers in advance.....