Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old December 10th, 2003, 07:21 AM
Beagles Beagles is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 70 Beagles User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 52 m 24 sec
Reputation Power: 5
Unhappy Query-Report problem

I know the answer to this must be a simple one, but I can't figure it out and I need to quickly.

I have 4 tables tied together.
Job Function is the parent table. The child tables are General Requirements, Local Requirements, and Job Elements. They are tied together by the Job Function field which is the PK or part of the PK on each table.

I have a query that is selecting the Job Function from the Job Function table, General Requirements from General Requirements table, Requirements from the Local Requirements table, and Elements from the Job Elements table. The query results in each row having the Job Function (1 in this case), General Requirements (5), Requirements (6), and Elements (1). So there are 30 records because one is created for each General Requirement-Local Requirements combination.

The bigger problem then arises when running the report. The 6 Local Requirements print out for each of the General Requirements.

The report should merely list the 5 General Requirements and the 6 Local Requirements and that is it.

I have tried adding the fields to Sorting and Grouping, hiding duplicates, etc., but I cannot get the report to read the way I want.

What it should say:

Gen Req Loc Req

1 A
2 B
3 C
4 D
5 E
F

(The F is lined up on the report, I just can't get it to post properly)

What I'm currently getting

Gen Req Loc Req

1 A
1 B
1 C
1 D
1 E
1 F

2 A
2 B
2 C
2 D
2 E
2 F

and so on (I can get Gen Req to print only if I have hide duplicates in the field properties, but that doesn't resolve the problem).

HELP!!! Thanks in advance!

Reply With Quote
  #2  
Old December 10th, 2003, 11:03 AM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
You are not going to be able to resolve you problem in the query portion of this report (at lease not without a very complex query, that I don't know how to create). The layout of your DB won't want allow.

What you want is:
- three individual queries for each child item
- three individual subreports for each child query
- One main report where you embbed (drag and drop) each subreport on to which will give you something like

Function
- Function Info
Elements
- Element Info
General Requirements
- General Req 1
- General Req 2
- General Req 3
- General Req 4
- General Req 5
Local Requirments
- Local Req 1
- Local Req 2
- Local Req 3
- Local Req 4
- Local Req 5
- Local Req 6



The closest I could get you to what you wanted was with the following UNION query (it listed 12 records - not 6)

SELECT Function.FunctionKey, Elements.ElementKey, "" AS GeneralKey, "" AS LocalKey
FROM Function INNER JOIN Elements ON Function.FunctionKey = Elements.FunctionKey
union
SELECT Function.FunctionKey, "" AS ElementKey,General.GeneralKey, "" AS LocalKey
FROM Function INNER JOIN [General] ON Function.FunctionKey = General.FunctionKey
UNION
SELECT Function.FunctionKey, "" AS ElementKey, "" AS GeneralKey, Local.LocalKey
FROM Function INNER JOIN [Local] ON Function.FunctionKey = Local.FunctionKey;

With the following ouput:

FunctionKey,ElementKey,GeneralKey,LocalKey
1,,,1
1,,,2
1,,,3
1,,,4
1,,,5
1,,,6
1,,1,
1,,2,
1,,3,
1,,4,
1,,5,
1,1,,


Good-Luck
S-

Reply With Quote
  #3  
Old December 10th, 2003, 02:50 PM
Beagles Beagles is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 70 Beagles User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 52 m 24 sec
Reputation Power: 5
Thanks S! I had tried some individual queries and some subreports, but not for all 3 items at once. I kept thinking there was some way to get it in a different format because I thought I had done it in the past.

Thanks again!

B

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > Query-Report problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway