Solved

MS Access 2003 Query

Posted on 2011-03-09
5
300 Views
Last Modified: 2012-05-11
I am trying to create a query based on the fields on the table in the file provided.  I know how to combine the fields Part Name and Part Family into one.  What I need from is in the other fields how to create a query that after i group the records in the first two fields and then count the other records in the other fields based on the first two letters in each field.  As an example the first field that would need to count is which gate broke.  The first column in the query would take Part Name and Part Family and combine them into one column and the rest of the fields in the query would be Assy, DC, FI and MC.  These would contain the count of each from the other fields in the query.
db1.mdb
Book1.xlsx
0
Comment
Question by:AisinAuto
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 10

Expert Comment

by:answer_dude
ID: 35089152
Can you provide a sample of the output that you're looking to create?  I don't understand the relationship between your database table and the spreadsheet...
0
 
LVL 10

Expert Comment

by:answer_dude
ID: 35089202
If I read your question correct this query might work -- however it involves some text manipulation on the "Which Gate Broke" field -- I would recommend creating another distinct field to capture the type (DC, FI, etc.)
TRANSFORM Count([Active Sorts].[Issue Number]) AS [CountOfIssue Number]
SELECT [Part Name] & " - " & [Part Family] AS Product
FROM [Active Sorts]
GROUP BY [Part Name] & " - " & [Part Family]
PIVOT IIf(Left([Which Gate Broke],2)="DC","DC",IIf(Left([Which Gate Broke],2)="FI","FI",IIf(Left([Which Gate Broke],3)="M/C","M/C",IIf(Left([Which Gate Broke],4)="Assy","Assy","Other"))));

Open in new window

0
 
LVL 10

Accepted Solution

by:
answer_dude earned 500 total points
ID: 35089215
Here's your DB back with the query in it.
26875331.mdb
0
 
LVL 1

Author Comment

by:AisinAuto
ID: 35097963
Does your query include the other fields as well, Gate 2, Gate 3 and Last Gate Broke?
0
 
LVL 10

Expert Comment

by:answer_dude
ID: 35337449
Sorry!!  I missed your follow up question.

My query only dealt with the "Which gate broke" field.

How would you want the other three included?  Are they additional breaks?  For example, Issue number 1-0021 has Which Gate Broke = "DC Catch Station" and Gate 2 = "DC hourly Check" and Last Gate To Break = "QC Patrol (D/C)"

So... does that translate to two DC errors and one QC error on part "9404 Upper Valve Body"

If so, then we would have to repeat what I did for the "Which gate broke" field for each of the other fields and then union/group them by part number.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question