Form/SubForm

J

JWeaver

I enter information each week onto a Form that is a summary of hours worked
for each employee during that week. I now want to be able to enter more
detail for each week and thought a sub-form would be better to do this,
either as a pop-up or added to the current Form, that would contain this
information in a separate table that would be related to the current table.

What is best way to do this?
 
K

Klatuu

Subform. That is what they are for.
Be sure to use the Link Master and Link Child fields properties of the
subform control so only records related to the main form's current records
are displayed. It will also take care of updating the field indentified in
the child Fields property.
 
J

JWeaver

How do I actually go about setting up the Subform? I tried before and it
didn't work like I wanted it to so I wiped it out and wanted to try again but
I am unclear as to how to do this the right way. Any help/guidance would be
appreciated.
 
K

Klatuu

Frst, create the form you will use for a subform. Just like you would any
other form. You probable want to make the Default View Datasheet.

On you main form, select a subform control and put it on your main form
where ever you want it. If the wizard pops up, close it.
Give the subform control a meaningful name
In the Source Object property, put the name of the form you created.
In the Link Master Field(s) property, put the name of the field in the main
form's recordset that relates to the recordset of the sub form's recordset.
In the Link Child Field(s) property, put the name of the field in the
subform's record sourec that relates to the field in the main form's
recordset.

That is about all there is to it. The one thing that can be confusing is
how you address controls, properties, and methods on the subform from code in
the main form. Note that the subform is contained in the subform control,
The form being used as the subform has the object reference of Form. So if
you want to refer to a control on the subform from the main form it is:

Me.SubFormControlName.Form!ControlName

And if you need to refer to something on the main form from code in the
subform, it is:

Me.Parent!ControlName.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top