473,790 Members | 3,200 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Count instances of values in a query

theaybaras
52 New Member
Hi all,

I have a table [tblClientLog] and a subtable [tblCAssessments].

CAssessments is a combobox that looks up a table called [tblAssessList]

AssessList has 2 columns, an autonumber PK and a string for the title of the Assessment. When the user meets with a client, they input the valid demographic details and time spent with client, and then in the subtable CAssessments they input any assessments they ran with their client. I need to have a report of the total number of hours spent between Date 1 and Date 2. Also, I need to have a report on the number of times each assessment in [tblAssessList] exists in [subtblCAssessme nts].

I am not sure where to begin to have this do what I need it to do. The other thing is that I need it to count each instance of a unique assessment, but if someone adds an assessment title to the list, I need a count for that one too. I really don't know where to begin! Any suggestions? the metadata for the three tables is as follows
[code]
Table Name=tblClientL og
Expand|Select|Wrap|Line Numbers
  1. Field; Type; IndexInfo
  2. C_Key; AutoNumber; PK
  3. C_Location; Numeric; (looks up tblLocations)
  4. C_Client; String
  5. C_ClientDate; Date/Time
  6. C_StartTime; Date/Time
  7. C_Hours; Numeric
  8. C_CType; Numeric; (looks up tblcontacttype)
  9. C_Interaction; Numeric; (looks up tblinteracts)
  10. C_Gender; Numeric; (looks up tblgenders)
  11. C_Age; Numeric
  12. C_Race; Numeric; (looks up tblethnicity)
  13. C_Orient; Numeric; (looks up tblorientation)
  14. C_PhysOrth_Disability; Yes/No
  15. c_Blind_Disability; Yes/No
  16. C_Deaf_Disability; Yes/No
  17. C_Cognitive_Disability; Yes/No
  18. C_Developmental_Disability; Yes/No
  19. C_MentalIllness_Disability; Yes/No
  20.  
the subform to the previous table is as follows
Expand|Select|Wrap|Line Numbers
  1. CA_Key; autonumer; PK
  2. CA_C_Key; numeric; FK from tblClientLog
  3. CA_Ass; numeric; (looks up tblAssessList)
the list of assessments is in tblAssessList is as follows
Expand|Select|Wrap|Line Numbers
  1. ASS_Key; autonumber; PK
  2. ASS_Name; string; (title of assessment)
An example of what I need is as follows. The data in my tblAssessList is:
01; Addiction Severity Index
02; Beck Depression Inventory
03; Outcome Questionnaire 45.2

tblClientLog (filtered to a few pertinent fields)

C_Key; 01
C_Client; A1B37C
C_Hours; 3
C_ClientDate; 05/19/2007

C_Key; 02
C_Client; A2B37D
C_Hours;1
C_ClientDate; 04/08/2007

tblCAssessments
CA_Key; 01
CA_C_Key;01
CA_Ass; Addiction Severity Index

CA_Key; 02
CA_C_Key; 01
CA_Ass; Outcome Questionnaire 45.2

CA_Key; 03
CA_C_Key; 02
CA_Ass; Outcome Questionnaire 45.2

CA_Key; 04
CA_C_Key; 02
CA_Ass; Beck Depression Inventory

I need to have something that counts these instances and reports:
Addiction Severity Index = 1
Outcome Questionnaire 45.2 = 2
Beck Depression Inventory = 1

Total Client hours from date 1 to date 2 = ?
(i.e. hours between 04/25/07 and 05/25/07 = 3)
(i.e. hours between 03/25/07 and 05/25/07 = 4)


If that wasn't as clear as I'm hoping, please let me know! I'd appreciate any guidance you can share!

Thanks so much!

theAybaras
May 28 '07 #1
2 2459
garethfx
49 New Member
Ok in reverse order. The issue of counting against unique assessment - use a crosstab query. If you try and build a report directly licked to the crosstab it will not pick up on newer assessment types added so build a report on the fly for now.

building a query based on the client will give to the consultations between 2 dates ( use the criteria to request date input) then a calculation in the same query to sum the hours taken
May 28 '07 #2
theaybaras
52 New Member
Hi there!

Thanks so much for your response. I've got my crosstab query, and it's doing exactly what I was hoping for! What I'm not sure of is what you are talking about for my report. How do I create my report 'on the fly?' Also, for the second part, when I make my report and query for client hours between two dates, how do I get it to pop up a form for the user to enter the dates into?

Thanks so much! Already you've been so much help!
May 28 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
18284
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 display the number of times a certain value appears in a certain field (i.e. perform a ‘count'). I will be doing this for many values in many fields so do not wish to have scores of queries to build my report.
1
3446
by: Chris Wolfe | last post by:
I have two fields that draw their combobox values from the same table. LogBook04.Insurance is the Primary Insurance and LogBook04.SecIns is the Secondary Insurance. Both draw their values from tblInsurance.Insurance. The Primary Insurance or the Secondary Insurance could be any one of the values on the Insurance table. I'm trying to count the occurances of each type of insurance, regardless of whether it is primary or secondary.
1
6583
by: Big Time | last post by:
I've got a crosstab query that counts the number of values in one of my tables. However, rather than giving me the number of instances of each record, what I would like is for each value to display, separated by a comma. For example, in the query is a row is named BC and a column named Vancouver, it currently displays "4" for the number of instances that Vancouver appears combined with the BC field. However, what I would like to display...
4
7777
by: alltechsolutions.net | last post by:
Been at this for two days now... I have a customer database with various fields, two of which are: ContactID (an autonumber field) & ReferralID (long Integer) When a customer refers someone new, the new customer gets the referee's ContactID in their ReferralID field. So someone who refers 10 people will have 10 instances of their ContactID scattered down the ReferralID column.
1
1846
by: sammy | last post by:
If you have a select with 2 attributes where you group by one attribute and do a count() for the second attribute, if the count() is 0 then that row is never displayed. How would you instead see a line item where you list the attribute with 0 as the count.
22
12495
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=" & msDbFilename moConn.Properties("Persist Security Info") = False moConn.ConnectionString = msConnString moConn.CursorLocation = adUseClient moConn.Mode = adModeReadWrite' or using default...same result
3
13691
jenkinsloveschicken
by: jenkinsloveschicken | last post by:
I am somewhat new to Access and have been tasked with creating a reporting database for my operation. The problem I am having is that I am needing to use the Count function to calculate total instances for each phone agent within the report, then use these counts to calculate a percentage for a report. Sample recordset: Specialist ID, Specialist Name, Brand Satisifaction, Specialist Satisfaction 111111 John Doe 4 ...
2
12081
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 contains "AAA" the count is X. if the field contains "CCC" the count is Y. if the field contains "Stop" then count is Z. I have tried several ways and can not seem to get any where. I get the same count for all string values. Can some one...
3
4885
WyvsEyeView
by: WyvsEyeView | last post by:
This seems like it should be so easy to do. I have a table, called tblTopics. Each topic can have one or more instances, contained in a table called tblTopicInst. tblTopics is bound to a form called frmTopics and tblTopicInst is bound to a form called frmTopicInst. From frmTopics, you access frmTopicInst via a button. I have also created a query, qryCountInst, that counts the number of instances for the topic currently displayed on frmTopics. I...
0
9666
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9512
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10201
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9987
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7531
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5424
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5552
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4100
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3709
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.