By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,302 Members | 1,760 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,302 IT Pros & Developers. It's quick & easy.

Reporting data between 6 'master' tables and 1 'child' table

P: 5
I want to have seven tables (relationship between them already exists) that report the data as follows;

Table 1-6 - Masters: data is input here
Table 7 - Child: data from Master is relayed here

I have tried with a Query to no avail, and even though the master tables have test records populating them I cannot seem to get the necessary fields shown in the Child table... Help!
Mar 18 '14 #1
Share this Question
Share on Google+
8 Replies


zmbd
Expert Mod 5K+
P: 5,397
You wouldn't do that with Table7 you would do that by query.
So what we need is a little more detail with tables 1 - 6, takeing just three for example:

tbl1
[tbl1_pk]
[tbl1_field1]

tbl2
[tbl2_pk]
[tbl2_field1]
[tbl2_fk_tbl1] (1:M with tbl1)

tbl3
[tbl3_pk]
[tbl3_field1]
[tbl3_fk_tbl1] (1:M with tbl1)
[tbl3_fk_tbl2] (1:M with tbl2)

Then we need to know what you have already attempted, so if you have the SQL (open the query in design view, right click in the show table area, select SQL view from the popup) then click on the [CODE/] button in the post toolbar and then copy and past the SQL script between the [code] [/code] tags.

From there tell us what fields from tbl1-3 you want to show (or in your case tables 1 thru 7 (^_^) ).
Mar 19 '14 #2

P: 5
The SQL is as follows:

Expand|Select|Wrap|Line Numbers
  1. SELECT [Employee List].[Employee Name]
  2.    , [Employee List].[Pay rate]
  3.    , [Labor - Entry Scans].Station AS [Labor - Entry Scans_Station]
  4.    , [Labor - Entry Scans].[Entry Scan] AS [Labor - Entry Scans_Entry Scan]
  5.    , [Labor - Exit Scans].Station AS [Labor - Exit Scans_Station]
  6.    , [Labor - Exit Scans].[Exit Scan] AS [Labor - Exit Scans_Exit Scan]
  7.    , [Tracking - Entry Scans].Station AS [Tracking - Entry Scans_Station]
  8.    , [Tracking - Entry Scans].[Entry Scan] AS [Tracking - Entry Scans_Entry Scan]
  9.    , [Tracking - Exit Scans].Station AS [Tracking - Exit Scans_Station]
  10.    , [Tracking - Exit Scans].[Exit Scan] AS [Tracking - Exit Scans_Exit Scan]
  11.    , [Tracking Detail].[Work Ticket ID], [Tracking Detail].ID
  12. FROM [Tracking Detail] 
  13.    INNER JOIN ([Tracking - Exit Scans] 
  14.       INNER JOIN ([Tracking - Entry Scans] 
  15.          INNER JOIN ([Labor - Exit Scans] 
  16.             INNER JOIN ([Labor - Entry Scans] 
  17.                INNER JOIN ([Employee List] 
  18.                   INNER JOIN [Work Tracking] 
  19.                      ON ([Employee List].[Pay rate] 
  20.                         = [Work Tracking].[Rate]) 
  21.                         AND ([Employee List].[Employee Name] 
  22.                            = [Work Tracking].[Employee Name])) 
  23.                   ON [Labor - Entry Scans].[Entry Scan] 
  24.                      = [Work Tracking].[Labor - Entry Scans]) 
  25.                ON [Labor - Exit Scans].[Exit Scan] 
  26.                   = [Work Tracking].[Labor - Exit Scans]) 
  27.             ON [Tracking - Entry Scans].[Entry Scan] 
  28.                = [Work Tracking].[Tracking - Entry Scan]) 
  29.          ON ([Tracking - Exit Scans].[Station] 
  30.              = [Work Tracking].[Station])
  31.             AND ([Tracking - Exit Scans].[Exit Scan] 
  32.                   = [Work Tracking].[Tracking - Exit Scan]))
  33.       ON ([Tracking Detail].[ID] 
  34.           = [Work Tracking].[ID])
  35.          AND ([Tracking Detail].[Work Ticket ID] 
  36.             = [Work Tracking].[Work Ticket ID]);
>>

If you need more details let me know!!
Mar 19 '14 #3

zmbd
Expert Mod 5K+
P: 5,397
Exactly how did this SQL fail you?
The more related information you can give, the fewer posts it should take to help you reach your goal.
Mar 19 '14 #4

P: 5
Well, the table is used for tracking inventory. This query picks up all the needed data for reports, views etc and is supposed to be a single place repository for all the needed data to then be used, edited and changed by the users. The issue that I have with the SQL is that I need an action that can report the data input in every single one of the selected fields from the populated master tables.

As of this moment, the relationships work and I get the heading views I want, but none of the already input test data is reporting in the related fields... Help...
Mar 19 '14 #5

zmbd
Expert Mod 5K+
P: 5,397
1) Which Version of Access/Office

2) Do you have the privilage of changing the field names?
The spaces are allowed now (however, I still advise against them) but using the dash sign can lead to issues.
Access 2007 reserved words and symbols
AllenBrowne- Problem names and reserved words in Access

3) It' will take a little bit to digest your SQL

4) It would help if you would list your tables as I outlined in Post#2 . This way we can see if there are any logic errors in your joins.

5) When you set up your table relationships, did you use the "Wizard" at table level or did you use the Database tools and set the relationships using the relationships tool?
Mar 19 '14 #6

P: 5
1)Access 2013/Office 365

2)I am the sole user (for now) creator and administrator of the file.

3)Sorry about that. The whole idea is to have a query or a central table reporting the required fields from all the other tables. This would be a view only (no edit capability) table for the end users to see.

4)(Due to confidentiality agreements I have changed the names, yet I've left the relationships) * = Primary Key. ** = Current relationship join to main table:

Main Table:
ID*
ENTRY SCAN-A
EXIT SCAN-B
ENAME
RATE
ENTRY SCAN-C
EXIT SCAN-D
STATION
PART_ID

Table 1:
ID**
DESCRIPTION
SIZE
CNAME
CID
ATIME
EPROC

Table 2:
RECORD#*
ID**
PART_ID
ENAME
EID
STATION
ENTRY SCAN-A

Table 3:
RECORD #*
EID
ENAME**
STATION
RATE

Table 4:
RECORD #*
ID**
PART_ID
ENAME
EID
STATION
EXIT SCAN-B

Table 5:
RECORD #*
ID**
PART_ID
STATION
ENTRY SCAN-C

Table 6:
RECORD #*
ID**
PART_ID
STATION
EXIT SCAN-D

That is the table structure. The tables in which RECORD # is the PK is due to the fact that the regular PK, ID will be used multiple times in the same table, as the job moves from station to station, each ID can repeat with different stations, times, etc.

Sorry about the complexity of it :/
Mar 21 '14 #7

P: 5
And 5)I used the relationship wizard on the database tools ribbon (I selected who's related to who)
Mar 21 '14 #8

zmbd
Expert Mod 5K+
P: 5,397
I think you need to renormalize\design your database and then your entire issue will dissolve; however, I really can't make heads nor tails of your workflow...

Compounding the issue is that the SQL you posted in 3 doesn't match the tables in posted in 7 so attempting to related the information just doesn't work...

I understand confidentiality; however, we can change Company and part names to generics like "Company" and "BlueWidget1" then post back the SQL and tables so that they make sense.

Please indicate the relationships as I did in post 2

Tbl_Example
[field] PK
[field2] FK((1:M with Tbl_Example2)
Mar 24 '14 #9

Post your reply

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