473,414 Members | 1,980 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,414 software developers and data experts.

How to populate an unbound Report from multiple tables?

I've recently completed my Work Instructions database and now I want to create a Report which shows each Instruction. Below is a simplified version of my database and problem.

I want to populate the Report with data from multiple tables. All the tables are related to eachother. These are my tables:

Expand|Select|Wrap|Line Numbers
  1. tblSteps
  2. StepID     Description     Picture
  3. 1            AAA           C://xxxx
  4. 2            BBB           C://xxxx
  5. 3            CCC           C://xxxx
  6. Etc.
  7.  
  8. tblStepParts
  9. StepPartID   StepID   PartID    Qty
  10. 1               3        8       3
  11. 2               3        6       3
  12. 3               3        3       4
  13. 4               3        1       4
  14. 5               2        2       1
  15. 6               2        3       10
  16. 7               1        3       6
  17. 8               1        5       4
  18. 9               1        2       1
  19. Etc.
  20.  
  21. tblParts
  22. PartID     Name
  23. 1         WASHER
  24. 2         RING
  25. 3         NUT M8
  26. 4         COVER
  27. 5         CYLINDER
  28. 6         HOSE
  29. 7         PIN
  30. 8         BOLT M8
  31. Etc.
  32.  
  33.  
I have a mainform (mainForm) with a header and a footer. On this mainform I have a Subform (subForm1). This subform contains another subform (subsubForm1). The height of subsubform1 is 3", the height of subForm1 is 6". This ensures that on each Report page there are two subsubForm1's visible.

Subsubform1 contains 4 textboxes to show Part names, 4 textboxes for their quantities, 1 textbox for the Step description and 1 image control to display a picture.

Normally you bound a control to the form and the form to a table. But my problem is that each StepID contains multiple PartID's which are stored in another table.

Can someone point me in the right direction?
Dec 9 '14 #1

✓ answered by twinnyfo

jeroen,

First, I need to clarify that you are building a Report and not another Form.

If you are trying to print out the instructions, then I would highly encourage you to create a Report (same principles as a Form, but better able to deal with some of your "subform" issues).

If I were building this report, I would create the query first, such that your results would look like this:

Expand|Select|Wrap|Line Numbers
  1. StepID  Description  Picture   StepPartID  StepID  PartID  PartName  Qty
  2.  1         AAA       C://xxxx      7          1       3    NUT M8     6
  3.  1         AAA       C://xxxx      8          1       5    CYLINDER   4
  4.  1         AAA       C://xxxx      9          1       2    RING       1
  5.  2         BBB       C://xxxx      5          2       2    RING       1
  6.  2         BBB       C://xxxx      6          2       3    NUT M8    10
  7.  3         CCC       C://xxxx      1          3       8    BOLT M8    3
  8.  3         CCC       C://xxxx      2          3       6    HOSE       3
  9.  3         CCC       C://xxxx      3          3       3    NUT M8     4
  10.  3         CCC       C://xxxx      4          3       1    WASHER     4
This can be done by simple joins, which I think you are capable of doing (based on what I've seen so far in your other threads).

This will allow you to build a report very easily, grouping on the various parts of the report (StepID, PartID, etc.).

There are other ways to do this, but can be more involved. If you wanted to use Sub-Reports, you would typically create several queries that addressed the specific information of each Report: The Main Report would only have information such as StepID, Description and Picture. The First Sub-Report would list all the Step Parts, but include the StepID, so you could establish a Master-Child relationship on the Sub-Report. Another Sub-Report would have a query that lists only the Parts and their Quantities (again, with StepID). Then these Sub-Reports would be arranged on the Main Report to your liking.

If the Sub-Reports have the CanGrow Property set to True, you could also set these Sub-Reports to be "invisible" when there are no records by setting the height to 0.

Lots of different options for this one, but what you are asking for is neither strange or difficult. But, when one has not done it before, it can be confusing.

Hope this hepps!

2 1483
twinnyfo
3,653 Expert Mod 2GB
jeroen,

First, I need to clarify that you are building a Report and not another Form.

If you are trying to print out the instructions, then I would highly encourage you to create a Report (same principles as a Form, but better able to deal with some of your "subform" issues).

If I were building this report, I would create the query first, such that your results would look like this:

Expand|Select|Wrap|Line Numbers
  1. StepID  Description  Picture   StepPartID  StepID  PartID  PartName  Qty
  2.  1         AAA       C://xxxx      7          1       3    NUT M8     6
  3.  1         AAA       C://xxxx      8          1       5    CYLINDER   4
  4.  1         AAA       C://xxxx      9          1       2    RING       1
  5.  2         BBB       C://xxxx      5          2       2    RING       1
  6.  2         BBB       C://xxxx      6          2       3    NUT M8    10
  7.  3         CCC       C://xxxx      1          3       8    BOLT M8    3
  8.  3         CCC       C://xxxx      2          3       6    HOSE       3
  9.  3         CCC       C://xxxx      3          3       3    NUT M8     4
  10.  3         CCC       C://xxxx      4          3       1    WASHER     4
This can be done by simple joins, which I think you are capable of doing (based on what I've seen so far in your other threads).

This will allow you to build a report very easily, grouping on the various parts of the report (StepID, PartID, etc.).

There are other ways to do this, but can be more involved. If you wanted to use Sub-Reports, you would typically create several queries that addressed the specific information of each Report: The Main Report would only have information such as StepID, Description and Picture. The First Sub-Report would list all the Step Parts, but include the StepID, so you could establish a Master-Child relationship on the Sub-Report. Another Sub-Report would have a query that lists only the Parts and their Quantities (again, with StepID). Then these Sub-Reports would be arranged on the Main Report to your liking.

If the Sub-Reports have the CanGrow Property set to True, you could also set these Sub-Reports to be "invisible" when there are no records by setting the height to 0.

Lots of different options for this one, but what you are asking for is neither strange or difficult. But, when one has not done it before, it can be confusing.

Hope this hepps!
Dec 9 '14 #2
Thnx! Got it working with the Master-Child relations.
Dec 11 '14 #3

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

Similar topics

2
by: Sami | last post by:
Could someone explain clearly how to go about doing this? I have tried setting up the structure on numerous occasions, but it never seems to work. Could someone please help me out? Thanks!
1
by: Brian | last post by:
I have a dataset containing 2 tables. I need to fill a datagrid using data from both of these. If I could create a SQL Statement to fill the datagrid, it would look like this: SELECT...
3
by: Yul | last post by:
Hi, We are in the process of designing an ASP.NET app, where a user will enter some 'Customer ID' to be queried in the database. If the ID is valid, several stored procedures will be called to...
1
by: Raj | last post by:
Hi I am trying to populate datagrid with a query which has multiple tables on it. It loads data fine but when I try to apply tablestylegrid and columnstyles its not taking it. Can anybody...
5
by: mimo | last post by:
Hello, I have seen samples on how to pull data from one table and save back to it using the Form View control. How do I pull from multiple tables and save back to multiple tables on one...
13
by: ricky.agrawal | last post by:
I'm really not sure how to go about this in Access. What I've created is a table for each location. Those tables are identical in format but different in information. The tables are named after...
6
by: ApexData | last post by:
I have 2 tables: Table1 and Table2. Neither one has a primary key because each table will only have 1-record. My form is a SingleForm unbound with tabs (my desire here). Using this form, in...
0
by: redpears007 | last post by:
Morning all! :) I have a database with multiple linked tables. I have created a search form with one txt box, for entering search criteria, and a listbox for each of the tables to isplay the...
1
by: Mitch Johnson | last post by:
I work for a construction services company. I have three tables: Contacts Companies Projects I want to complete a basic contact form, where their company, business address, contact info, etc....
4
by: slenish | last post by:
Hello all, Im having a problem getting a report to work with multiple tables. First let me give a little detail in to how im doing this. I am using a form to pull the report. I have a report...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.