473,385 Members | 2,013 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,385 software developers and data experts.

How to display multiply records in query?

awu
All:
I use two tables to generate a query.

The fields in table 1:
stylenumber
productline
One productline can have many stylenumbers in this table.

The field in table 2:
stylenumber
componentnumber
status
One stylenumber can have many components. Each component has one of 4
status.

My query wants to display component counts for each stylenumber under
single productline. For example, this query can be

productline stylenumber CountOfComponent Status
p1 s1 32 1
p1 s1 8 2
p1 s1 2 3
p1 s1 5 4
p1 s2 7 1
p1 s2 6 3

In my form, I want to disply each stylenumber with all the count for
each status.

stylenumber s1 32 8 2 5
I tried many ways, using DLookup, DCount, etc, no success. Really need
help

Thank you much
awu

Nov 13 '05 #1
1 2345

"awu" <aw***@hotmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
All:
I use two tables to generate a query.

The fields in table 1:
stylenumber
productline
One productline can have many stylenumbers in this table.

The field in table 2:
stylenumber
componentnumber
status
One stylenumber can have many components. Each component has one of 4
status.

My query wants to display component counts for each stylenumber under
single productline. For example, this query can be

productline stylenumber CountOfComponent Status
p1 s1 32 1
p1 s1 8 2
p1 s1 2 3
p1 s1 5 4
p1 s2 7 1
p1 s2 6 3

In my form, I want to disply each stylenumber with all the count for
each status.

stylenumber s1 32 8 2 5
I tried many ways, using DLookup, DCount, etc, no success. Really need
help

Thank you much
awu


If you can have any number of stylenumbers for a given productline, I don't
see any reasonable way to output the data that way. Your example shows 4,
but what if some have 8... or 18?

Perhaps a simple aggregate query might do what you need?

Select
t1.productline,
t2.stylenumber,
t2.status,
count(t2.componentnumber) as countofcomponent
From
table1 t1, table2 t2
Where
t1.stylenumber = t2.stylenumber
Group By
t1.productline,
t2.stylenumber,
t1.status

This would give you - a row with a count of components for each combination
of productline, stylenumber and status.

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Jerome | last post by:
Hi, I've got the following problem: I want my ASP page to display a certain number (based on a COUNT query), it works fine if the result is at least 1! If there are no records to be counted...
3
by: matthewemiclea | last post by:
I am trying to display information in Access on a form that takes information from many different queries and puts them together on a spreadsheet or chart. Some specific info: The information I...
6
by: geronimo_me | last post by:
I have 20 queries that compare fields in one table with fields in another table - the query results are the records that do not match in Table1 and Table2. ie Table1 DOB 28/02/78 Table2 DOB...
3
by: google | last post by:
This is something I've done plenty of times in '97, but I can't seem to get it to work correctly in Access 2003. Say, for example, I have a form with an unbound combobox, the data source is a...
4
by: rn5a | last post by:
A MS-Access DB has 3 tables - Teacher, Class & TeacherClass. The Teacher table has 2 columns - TeacherID & TeacherName (TeacherID being the primary key). The Class table too has 2 columns - ClassID...
7
by: imtmub | last post by:
I have 3 table for Purchase Order from ERP Database Tables: POD=Purchase order Details(this table has Require Qty field) POR=Purchase Order Receive (This table has RequireQty and ReceiptQty...
12
by: petter | last post by:
Hi! I have two questions: one question that regards the COUNT-function, and one about how to display a month even if I don’t have any data for that month. I have an Access database where I want...
3
by: Coll | last post by:
I have a form that had been setup with a combo box. You'd select a value from the combo box and a query would open and display matching records. I now need to remove the combo box and set up a text...
1
by: sanchezl | last post by:
Hi, I am developing a program in visual basic that extracts info from an access database. So far I know how to add records, make a query and count the number of records that that query gives, but...
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
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...

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.