Full Version: Subform With Subform?
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
russerh0
Hello,

I am having trouble with a table structure that has three levels of data. I am able to create a form with a subform, but how do I create a subform within that subform? My three tables are set up with the following ID's that are linked. I want to see the data from the Company table at the top and then see all contacts for that company and within each of those contacts, see the communications with them.

Company Table:
CompanyID, ...

Contact Table:
ContactID, CompanyID,...

Communications Table:
ContactID,...


Can anyone help? Thank you!!
BananaRepublic
Did you actually try adding the subform control? Be aware that when you work with a subform in a form in design view, you sometime have to double-click to move focus inside the subform rather than on the subform control (which is still in the containing form). Once you've set the focus inside the subform that way, you should be able to add another subform there.

Alternatively, you could open the subform in its own window (e.g. clicking directly from either Database Windows or Navigation Pane and opening it in design view) then add subform there, save it then close and re-open the original containing form.
russerh0
I did try to create a subform within the other subform, but didn't see anything. I then tried creating a new subform separately and then added that in. Neither worked.

The first subform is a data sheet, so I thought that might be a problem, but I'm not sure.

My goal is to see a list of the contacts and then below each individual contact is a list of communications.
BananaRepublic
Is this datasheet actually a form or just a table? That is, when you created the subform, did you just select a table name or an actual form? If you selected a table that way, I would recommend against this approacn and encourage you to create a new form that would become the subform. You'll have more control that way.

Also, be aware that you cannot have a continuous subform within continuous subform as you can with datasheet within datasheet but there are workarounds if needed.
russerh0
Yes, they are all forms. I am not using any tables for the subforms.

How do you create the datasheet within the datasheet?

I know this should be easy, but I'm hitting a mental block on it. I don't think I understand how the third subform communicates with the first level form.

I would so appreciate it if you could help me to understand this because I run into this problem a lot when working with databases.

I am also having a similar problem when creating reports. Which makes me realize that I don't understand how it works with these tiered tables:

Instead of getting this...
Company 1
Contact 1A
Communication 1Ai
Communication 1Aii
Contact 1B
Communication 1Bi
Communication 1Bii
...I get....
Company 1
Contact 1A
Communication 1Ai
Company 1
Contact 1A
Communication 1Aii
Company 1
Contact 1B
Communication 1Bi
Company 1
Contact 1B
Communication 1Bii
russerh0
Also, if it would be easier to explain to me by making the changes directly to the database, I'd be happy to send it. It's a very simple database and I could learn how to do it by seeing what you did to fix it. Whatever is easiest for you. Thank you for your help!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.