Solved

MS Access 2003 Query

Posted on 2011-03-09
5
245 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
  • 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now