473,473 Members | 4,257 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to count the data from a combo box

6 New Member
I created a form that contains two combo boxes plus other information. The first combo box contains the following items: (Claim Under $5000, PIR/CPRA, Potential Claim, CA Vic Comp, Summons&Complaint, Request to produce docs). The second combo box contains the following items ( Vehicle Damage, windshield claim, not state Highway, ORIM, Contracts, Districts). Both combo boxes are related. I need to create a query that counts and displays how many Claims under $5000 were processed in total and how many of those claims under $5000 are for Vehicle Damage, Windshield Claim, Not state Highway, ORIM, Contracts, or Districts. I need to do the same for each item of the first combo box. PLEASE PLEASE Help. I have no idea if I have to do something in the AfterEvent option in the combo box. What will be the easiest way for a newbie like me to do this.
May 21 '10 #1
13 5622
Delerna
1,134 Recognized Expert Top Contributor
Not sure I understand your question fully

if the form is single record
the record control box at the bottom of the form shows

record n of NumRecs


If the form is continuous
open the footer of the form
add a textbox to the footer and in its control source property type
=count(FieldName)

where FieldName is the name of one of the fields in the form
May 21 '10 #2
Jim Doherty
897 Recognized Expert Contributor
@marsh07
Are you saying that you want this information processed as second and third columns in that combobox, so that when the combobox box drops down the numeric information is visible alongside each data value?
May 21 '10 #3
NeoPa
32,556 Recognized Expert Moderator MVP
It sounds like you want to count the occurrences of each in the data underlying the form (I can't see what else would make any sense if I'm honest).

If so, do you want the value of the count of the matching records to be shown on the form whenever a new selection is made?

Do you use the two ComboBoxes to filter the underlying data as it is?
May 21 '10 #4
marsh07
6 New Member
Hello to all, I was so frustrated last night with this assignment because I could not find any info online. I need to count the occurrences for each one of the items. If the user selects "Claim under $5000" from the first combo box and "Vehicle damage" from the second combo box, it will count 1 and 1 for each item and so forth. Then, I need a query that shows the following:
1. Claim under $5000 Total Occurrences:
(under this category)
-Vehicle Damage Total Occurences:
-windshield Claims Total Occurences:
-Not State Highway Total Occurencees:
- ORIM Total Occurences:
etc...
2. PIR/CPRA Total Occurences:
(under this category)
-Vehicle Damage Total Occurences:
-windshield Claims Total Occurences:
-Not State Highway Total Occurencees:
- ORIM Total Occurences:
etc...
Please do not think that I want you guys to do my assignment. I just need some guidance, I read that I need to use combo boxes for thos two lists, but I do not know what I need to do to count the occurences and where I need to place that command (combo box or query). Your help is appreciated greatly.
May 21 '10 #5
Jim Doherty
897 Recognized Expert Contributor
@marsh07
Take a look at the DCount Funtion in Access. Each one of those values is criteria that can be used by that function to count records based on that criteria value. You can do it different ways but as I see it you essentially have a field called 'Claim' and 'Claim Type' something like that. Both are inter-dependant.

The Dcount function is fully documented in Access help.

If you were more advanced I would suggest created a modular function of your own where the count would be done using a one column recordset returning the value to a function which could then be embedded in a query that serves as the rowsource for your dropdown thus giving you the extra column capability I mentioned before., but I think at this stage it might be too much to go with
May 21 '10 #6
marsh07
6 New Member
@Jim Doherty
Thank you Jim. I will try that and see what happens.
May 21 '10 #7
Jim Doherty
897 Recognized Expert Contributor
@marsh07
Yes I think it necessary that you understand the DCount Aggregate function it is one of many aggregate functions in Access. Look them up in help 'Aggregate functions' They are very commonly used bread and butter stuff. As you become more advanced then you can progress into understanding 'other' counting concepts essentially more efficient but I don't want to overload you with this...step by step is much better I think. Let us know how you go on :)
May 21 '10 #8
marsh07
6 New Member
Hello Jim, thank you for your consideration. I am trying to pass my access class and I do not even know why I need to take this class as I am a Business Admin. student. I admire each one of you for knowing all of this because this can be challenging.
Ok...this is what I am trying to do:
I understand that I need to store the occurrences of each item in a different place, so I created text boxes on the form for each one of the items...correct?
Then, in the control source for my first text box, I am trying to add the Dcount function as follows:
DCount ("[Claims]","Claimant","[combo14] = 'Claims under $5000'")

Claims=My table
Claimant= my form
Combo14= it's the combo box that contains the type of file
Claims under 5000= it is my first item of my combo box

This is not working yet, because the text box is displaying: "#Name?" . At least I would like to know if I am on the right track?
May 21 '10 #9
NeoPa
32,556 Recognized Expert Moderator MVP
Just as a clarification - These functions are generally referred to as Domain Aggregate Functions, as opposed to the Aggregate Functions, which pertain to those functions you can use from within SQL to aggregate across a GROUP BY clause. They are easily differentiated by starting with a D (for Domain).
DLookup(), DSum(); DCount(); etc
Whereas Sum(); Count(); Max(); etc are Aggregate Functions.

Sorry Jim. Not trying to be argumentative, and I'm sure you know this already. I just wanted to clarify in thread for the less experienced users.
May 21 '10 #10
Jim Doherty
897 Recognized Expert Contributor
@marsh07
Hi again

In your study of the functions concerned (the elements of which I need not repeat as they are full documented in help) and given that it 'is' a matter of studying and understanding their arguments. I have prepared a little db for you to look at that lists data in a claims table in line with your post.

Have a look at the drop downs how they interact, their row sources and the selection of calculated fields that are on screen. Each textbox has a function in it to perform either a count or sum based on the functional arguments.

Remember none of this 'calculated numeric' data is stored in the table because these ARE calculations on the fly, the results of which in themselves need 'not' ordinarily be stored as static physical data.

Remember with the Domain aggregate functionality you are essentially doing this - you are 'aggregating' the result of a column of physical data NOT as in your last post [combo14] is not relevant in that context is not correct. Study and extract the attached db contained in zippped format and you will get the idea.

Regards
Attached Files
File Type: zip Marsh07_Claims.zip (29.6 KB, 246 views)
May 22 '10 #11
marsh07
6 New Member
Thank you. I will check it out.
May 23 '10 #12
marsh07
6 New Member
Hello Jim,
Your file was very helpful. I think I finally got it. Thank you!!
May 26 '10 #13
Jim Doherty
897 Recognized Expert Contributor
@marsh07
You're welcome :-)
May 26 '10 #14

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

Similar topics

0
by: Meyer1228 | last post by:
VB6 - We have three data combo boxes with identical properties, each pointing to a different data file. We're using an odbc driver with a 4th gl indexed database. All that is working beautifully. ...
0
by: Andrew | last post by:
Hello, I am trying to create a chart whose underlying query is linked to 2 combo boxes on the same form. I want to pass the values from the combo boxes into the chart query to allow the chart...
1
by: ZZZ | last post by:
int dummy=Convert.ToInt32(das.Tables.Rows.ItemArray.ToString()); MessageBox.Show(dummy.ToString()); this.combo_opNaam.SelectedValue=dummy; ...
7
by: arynn | last post by:
hi. i have a table name result that contain result from a survey form. The table have username, a1,a2,a3,a4,a5,a6,.......a75 column which represent username and their answers to each question....
4
by: uprakash14 | last post by:
i have import excel data in MSflexgrid.. Now i want to count the data for particulars fields... Like Data have four column A, B, C and D while using A column, i have to calculate the data of B...
3
beacon
by: beacon | last post by:
Hey everybody, I'm using 2003 and wondering if there's a way to count the data for multiple sections in a report and summarize it at the end of the section. For instance, I have a report with a...
0
by: sunilkds | last post by:
I want to main difference simple Combo box & DataCombo Box @ VB6.0 What is combox.listindex in DataCombo
1
by: sunilkds | last post by:
How to count total number of items in the Data Combo in Vb6.0
1
by: sunilkds | last post by:
I want code for how to clear values in the datacombo at run time. Plz give corect method or solution
4
by: sunilkds | last post by:
I want code for how to clear values in the datacombo box (not combo box) at run time. Plz give corect method or solution
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
1
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
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 ...
0
muto222
php
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.