subform to main form

G

Guest

I have a main that has a tab control on it. The first tab holds the main
form controls for the main table (the one). On another tab there is a
subform that is a many to the one. On the subform (or table) there is a
field of data the user would like to show on the main tab. The field is the
number of hours a person worked on a project. The total number depends on
whether a corresponding checkbox is checked or not to indicate it is time
(hours) to add into the field on the main tab. The main tab field is
"ActualHours" and the subform field is "Hours" and checkbox on subform is
"Billable".

Where I am lost is how do I get the specific info from the subform (or
table) to the mainform control. So I ask for assistance on this matter and
thanks for responding.
.... john
 
G

Guest

My apologies but I forgot to include the line of code that is currently used
but it brings in all the hours and not just the billable. It would be the
finishing of this that is needed.

Me.txtActualTime = DSum("WorkTimeAmount", "tblProjectWorkTime", "ProjectID =
[Forms]![frmProject]![txtProjectID]")

Thanks for the assistance and sorry for any confusion.

.... John
 
G

Guest

Never mind, I got it figured out. Thanks if you took time to read this
posting.
.... John


JohnE said:
My apologies but I forgot to include the line of code that is currently used
but it brings in all the hours and not just the billable. It would be the
finishing of this that is needed.

Me.txtActualTime = DSum("WorkTimeAmount", "tblProjectWorkTime", "ProjectID =
[Forms]![frmProject]![txtProjectID]")

Thanks for the assistance and sorry for any confusion.

... John

JohnE said:
I have a main that has a tab control on it. The first tab holds the main
form controls for the main table (the one). On another tab there is a
subform that is a many to the one. On the subform (or table) there is a
field of data the user would like to show on the main tab. The field is the
number of hours a person worked on a project. The total number depends on
whether a corresponding checkbox is checked or not to indicate it is time
(hours) to add into the field on the main tab. The main tab field is
"ActualHours" and the subform field is "Hours" and checkbox on subform is
"Billable".

Where I am lost is how do I get the specific info from the subform (or
table) to the mainform control. So I ask for assistance on this matter and
thanks for responding.
... john
 
J

John W. Vinson

I have a main that has a tab control on it. The first tab holds the main
form controls for the main table (the one). On another tab there is a
subform that is a many to the one. On the subform (or table) there is a
field of data the user would like to show on the main tab. The field is the
number of hours a person worked on a project. The total number depends on
whether a corresponding checkbox is checked or not to indicate it is time
(hours) to add into the field on the main tab. The main tab field is
"ActualHours" and the subform field is "Hours" and checkbox on subform is
"Billable".

Where I am lost is how do I get the specific info from the subform (or
table) to the mainform control. So I ask for assistance on this matter and
thanks for responding.
... john

So you want the sum of the values in all the Billable fields, provided the
checkbox is checked?

Put a textbox (it can be invisible) on the Footer of the subform. Set its
Control Source to

= -Sum([Billable]*[ActualHours])

The minus sign is because a Yes/No field (Billable here) is -1 for True, 0 for
False.

Name the textbox txtTotal. On the mainform, put a second textbox, with control
source

=subformname.Form!txtTotal

where subformname is the Name property of the Subform Control on the second
tab page - this may or may not be the same as the name of the form within that
control.

John W. Vinson JVinson *at* Wysard Of Info *dot* com
 

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