473,386 Members | 1,827 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,386 software developers and data experts.

Trouble Counting/Separating Records

dgaletar
72 64KB
I am new to access (I am using Access 2010 version) and I am getting crazy. Consider also that I am a novice with DB in general, so now I am at the point that I am very confused... please help.

I have a database that keeps track of all of our work trucks. So far it has worked perfectly. Now my boss wants us to track how many of each size of windshield wipers we use. Now I know that this doesn't sound difficult, but it has driven me nuts for over a week now!!!

The problem is that each truck can have up to 3 windshield wipers on it... (1) DS (Drivers side), (1) PS (Passenger side), and (1) Rear.

The only information that I need to capture is the total quantity of each size wiper. Example, truck #1 uses a 18" wiper on the DS, a 16" wiper on the PS, and none on the rear. While truck #2 uses a 18" wiper on the DS, a 18" wiper on the PS, and a 12" wiper on the rear. That means that we use (1) 16" wiper, (3) 18" wipers, and (1) 12" wiper.

Seems simple, but for the life of me I can't figure out how to do this!!!

I have attached a zip of the database for your review.

**On the Navigation Page, under "General Details:", select the "- View and/or Edit All Vehicle Records" link. In the bottom right hand corner, in the "SERVICE SPECS" subform is where the wipers input fields are located. The dropdowns get their information from the "Wipers" table, and the wipers information is collected in the "SERVICE_SPECS" table.

Good luck and THANK YOU!!!

dgaletar
Attached Files
File Type: zip Vehicles1.zip (594.8 KB, 159 views)
Feb 26 '13 #1
12 1115
dgaletar
72 64KB
BTW, I just found this code in another forum. Does anybody think that I am on the right track by trying to use this???
Feb 26 '13 #2
Seth Schrock
2,965 Expert 2GB
I don't believe that Allen Browne's code is what you are looking for. Try looking into crosstab queries. I believe that is more along the line of what you are looking for. Crosstab Queries should help you along. Let us know if you have trouble with it.
Feb 26 '13 #3
zmbd
5,501 Expert Mod 4TB
Dgaletar:
Welcome back.

I would go with Seth on this and offer the option of a pivot table as well.

>
Just a reminder, most of us will not open an unsolicited attachment as a general precation. It should not be taken as a personal attack - just that people will often be infected without any knowledge.

You should also remember from your past experience, simply stating that your code "doesn't work," posting code or a database without explaining what, if any, troubleshooting has been performed, and expecting someone to help doesn't usually result in much of an answer and may result in your thread being deleted.

Instead, please tell us what you were expecting to happen, what actually happened, for each error: the EXACT title, error number, and descriptions that occurred and at what line in your posted code the error occurred. These are the minimum requirements for posting a question of this nature.
Feb 26 '13 #4
dgaletar
72 64KB
Hey Seth, thanks for the info. Unfortunately I am still pretty stuck. I guess that my issue is with the layout of the tables.

The way that I have it set up now is (1) table for the list of wiper sizes (titled "Wiper_Sizes"), and three fields added to the "SERVICE_SPEC" table. The three fields are labeled "DS", "PS" & "Rear" respectively.

When I try to create a crosstab query, I get the following issues:
  1. If I use the "Wiper_Sizes" table for the crosstab query results, I get an error saying that "the table doesn't have enough fields".
  2. If instead I use the "SERVICE_SPEC" table, I choose "DS", "RS" & "Rear" as the Row Headings, then I don't know what to use as the Column headings.

How can I get the "Wiper_Sizes" as the Row Headings, and the "DS", "RS" & "Rear" fields as the results (counted)?

PS - I also tried creating 4 different tables, "Wiper_Sizes", "DS", "PS" & "Rear", and that didn't work. And I tried creating 2 different tables, "Wiper_Sizes", and "Wiper_Loc" (which contained the "DS", "PS" & "Rear" fields), and that also didn't work.
Feb 27 '13 #5
zmbd
5,501 Expert Mod 4TB
Would you go back into the query design and try again using each method you listed and post the SQL for them?
Very hard to help when all we get is the basic - it doesn't work.

Even if it gives you an error when ran, you can still switch to the SQL view and <ctrl><c>&<p> the underlying SQL.

You might also read thru: Crosstab-query-techniques I have a few other tutorial links for CTQ that might be easier to follow.....
Feb 27 '13 #6
Seth Schrock
2,965 Expert 2GB
You wouldn't want the four different tables, but the two would probably work. However, since there would be a many to many relationship between those two tables, you would need a join table between them. You would then run the crosstab query on the join table.
Feb 27 '13 #7
dgaletar
72 64KB
OK, hang in there! I'm trying to do what zmbd asked. I'll be right back...
Feb 27 '13 #8
dgaletar
72 64KB
OK, I (we) did it!!! Using a crosstab query I was able to total the sizes for each field seperatly; “DS”, “PS” & “Rear”. In other words, when I run the crosstab query now I get the following:

(See screenshot 1 [top table] below)

…which is correct as to the test data that I entered into the table.

The only issue that I now have is to be able to add up the sizes in total. In other words, like this:

(See screenshot 1 [second table] below)

I await your directions…

Attached Images
File Type: jpg Screenshot1.jpg (21.4 KB, 142 views)
Feb 27 '13 #9
Seth Schrock
2,965 Expert 2GB
As Z stated before, it is hard to help without the SQL. Post what you have inside code tags. The [CODE/] button will insert them for you. Just place your code between the start and end tags.
Feb 27 '13 #10
dgaletar
72 64KB
Sorry 'bout that! I keep forgetting that I can do that...

Expand|Select|Wrap|Line Numbers
  1. TRANSFORM Count(SERVICE_SPECS.[CUA#]) AS [CountOfCUA#]
  2. SELECT SERVICE_SPECS.DS, Count(SERVICE_SPECS.DS) AS [Total Of DS], SERVICE_SPECS.PS, Count(SERVICE_SPECS.PS) AS [Total Of PS], SERVICE_SPECS.Rear, Count(SERVICE_SPECS.Rear) AS [Total Of Rear]
  3. FROM SERVICE_SPECS
  4. GROUP BY SERVICE_SPECS.DS, SERVICE_SPECS.PS, SERVICE_SPECS.Rear
  5. ORDER BY SERVICE_SPECS.DS, SERVICE_SPECS.PS, SERVICE_SPECS.Rear
  6. PIVOT SERVICE_SPECS.[CUA#];
  7.  
Feb 27 '13 #11
zmbd
5,501 Expert Mod 4TB
The link I posted tells you how...
Feb 27 '13 #12
dgaletar
72 64KB
Right, the paragraph that says"To show the total of all the columns in the row, just add the value field again as a Row Heading"

But the issue is that the columns that display the sizes (12, 14, 18, etc.) are not in the same order. So if I add a "value field" to the query, it won't be adding the right totals. Right?
Feb 27 '13 #13

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

Similar topics

2
by: Reply via newsgroup | last post by:
Folks, When performing an update in mysql (using PHP), can I find out how many records were matched? mysql_affected_rows() won't work... and I have the following problem that I thought I...
1
by: Samuel Hon | last post by:
I seem to remember reading many moons ago about a function where you can retrieve a count of the last recordset you opened. For example: I've got a stored procedure that returns a recordset...
8
by: Thomas van den Berg | last post by:
how can I count the number of blank-seperated word groups in a single field. The format I receive is aaa (aaa aaa )n(nnn). aaa can be any number of words, any length. The n(nnn) is not fixed length...
1
by: mjobrien | last post by:
i am having the hardest time trying to get an unduplicated count of student IDs from my report. i have the following report Student ID Term Hours 1111111 SU04 1.0...
4
by: BJ | last post by:
Can anyone tell me how to include a count of group records in a group footer. I know (I think I know!) that I have to include an unbound text box in the footer, but what expressions do I use to...
1
by: geronimo_me | last post by:
Hi, I have a query that has the following fields: Business: ID Number: LastName: EmpNo: Hours1: Hours2:
2
by: mattytee123 | last post by:
I have about 20 tables, of which I would like to do a union query and count of how many of each different code there is? The simplified verson of the table is structured like this. Code ...
0
by: Henrootje | last post by:
I have a continous form. That form has three checkboxes, two unbound and one (MyCheckbox1) bound to MyField. The whole form is bound to the table tblMyTable which contains the field MyField. ...
1
by: RussCRM | last post by:
I need some help getting unique records from our database! I work for a small non-profit homeless shelter. We keep track of guest information as well as what services we have offered for...
3
by: neelsfer | last post by:
If i use the code below to get the number of records in a subform , and i also use DoCmd.RunCommand acCmdRefresh to refresh screen, then the application stops working (the cursor never stops...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
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
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...

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.