Subformulario invertido

This question is an extension of one of my previous questions, which I've since resolved. See aquí para más detalles.

I have an issue with subforms. I have two tables, TableA and TableB with a one-to-many (parent-to-child) relationship from A to B. Now I know that Microsoft designed subforms so that the user could view/interact with information on a table on the many/child side of the relationship. My question is, can this be reversed? That is to say, can I have the subform for information on the one/parent side of the relationship?

In a broader context (see link above), I'm trying to use subforms because a combo box is to limited in capability. A combo box will allow multiple columns to be viewed via its Row Source property assuming the Column Count property is set to a value greater than 1. However, the text entry portion of the combo box, will only allow one entry. I need to be able to enter multiple field values in case a new record needs to be added to the underlying table.

If there is a completely different way to accomplish this that does not involve subforms, then that is fine. I am also considering cascading combo boxes as a possible solution.

Gracias de antemano.

preguntado el 24 de agosto de 12 a las 20:08

1 Respuestas

Yes, you can. You can have a form with two subforms. There is an example in the 2000 / 2003 Northwind sample database where selecting a record in subform one displays child records of the selection in subform 2. The relevant form is the Customer Orders form.

The way it works is by setting the link child and master fileds and by including a requery in the Current Event of the first subform:

Me.Parent![Customer Orders Subform2].Requery

Northwind Customer Orders subform Northwind Customer Orders subform design view

Respondido 24 ago 12, 21:08

MS Access 2010 doesn't seem to have that Form. This seems more like cascading subforms, which is interesting in its own right due to other issues I'm having with nested subforms. However, it does not appear to break the convention of having the subform on the many/child side of the underlying relationship. Of course I could be wrong. What are the relationships between the "Customer Orders", "Customer Orders Subform1", and "Customer Orders Subform2" tables? - qmckinsey

No, the sample form was not included in the 2010 Northwind, hence the mention of 2000 / 2003. In the example, customer orders parent form holds customers, but there is no reason why it should not be an unbound form that merely serves as a container for two subforms. To me your requirement suggested that you wanted a continuous form of parent data with a related child recordset. In the example, the second subform can be a single form or continuous, which seemed to match your requirement. In a way it is a cascading subform, but what esle could your requirement be? - fionnuala

I have three tables: A, B, and C. A is a child of B, and B is a child of C. My form needs to cycle through records on A, with a subform on B and a nested/cascading subform on C. In other words, the parent child relationships on my table are reversed, due to the nature of the data. Hence, the issue. Thanks for your help. - qmckinsey

I am afraid I am missing where the difficulty lies. As long a a table has a field on which to base the link child and master fields, it does not matter which is in the subform and which is in the main form. A little sample data may make it either easier for me to understand the problem or for someone to suggest a solution. - fionnuala

En este sitio ( it states: A subform (or a subreport) is a form (or a report) that you position inside of another form (or another report). In order to "include" one form (or report) into another form (or report), both objects must have a relationship. The form (or report) that is hosting the other form (or the other report) is the parent. The form (or report) that is added to the parent is called the child form (or child report). The parent object must have a primary key that "links" or relates it to a foreign key in the child object. - qmckinsey

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.