Changing a Form into a Subform

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a database that currently has two forms. I've determined that I want
one form to be a subform of the other, BUT I want a command button on the
first form that takes me to the second form (where I will add related
information).

Is there something I can do so that I can get Link Child and Link Master
fields to appear in the property sheet of the second form?

I know I can create what I want using the Create Form Wizard, but I would
like to know what is going on behind the scene -- later I expect to add
additional subforms (with Command buttons), and I don't know that I'll be
able to add these with a Wizard.

Any suggestions?
 
The Link Child and Link Master fields won't show in the properties of the
subform, they will show in the properties of the subform control on the main
form. The subform control is a control on the main form. This control is a
container for the subform. Have you placed the form you want to use as the
subform onto the main form? If so, open the form in design mode, open the
Properties sheet, and click the subform ONE time. The properties sheet will
give the properties of the subform control. If you click more than once,
you'll be in the subform and the properties sheet will show the properties
of the form used as the subform, not of the control that is holding it. If
this happens, just click back onto the main form and click the subform
again.
 
Wayne,
Thank you - I understand your answer, but how do I make this second form a
subform without putting it on the main form. I want to use a command button
to access the subform without using the wizard.

Dennis
 
If it's not on the main form, it's not a "sub" form. It sounds as if what
you are asking for is a pop-up form that will be filtered by the value of
the record that your "main" form is currently at. To do that, you could use
the WhereCondition argument of the DoCmd.OpenForm call to filter the pop-up
form. You would pass the value of the field that would be the Child/Master
link field. If you also use the acDialog WindowMode argument, you will have
to close or hide the pop-up form before proceeding further.
 
Another option would be to have the query feeding the "subform" use a
criteria that refers to the field on the "main" form that would be the
Master/Child link field. This will cause the query to filter the records.
You could leave the second form open and issue a Requery command for it as
you move from record to record on the main form.

Example:
Forms!frm2ndForm.Requery
 
Wayne,
Thanks again for the information (all three of your posts). I'm becoming
dangerous now because your note has forced my hand - I've got to write some
code. I've gotten the Access VBA Programming for Dummies book, and now
understand what your second and third posts mean. I'm also writing the code
to perform the task I want.

Dennis
 
Back
Top