Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to call a value from a main form into subform?

Status
Not open for further replies.

legendv

Technical User
Apr 10, 2002
32
US
How do you call a value from a form into a subform.
I have a form with a query calculated value of Days. There is a subform on this form with other values that need the days value for other calcs.

I'm thinking,
*in the subforms footer*
*in a textbox* formated to percent*
([subformfield] / [mainform]!Days)

Any ideas?
 
Here are a few untested ideas...

If the value in the Mainform field is likely to be recalculated several times while the mainform is open then you might place code in the calculated field's AfterUpdate event. Or, if the value changes only when the mainform moves from record to record then you could also use the mainform's OnCurrent event.

Use something like:
Forms!Subformname!Subformfield = Me.Mainformfield

Alternatively you might want to control the transfer from within the Subform using:

Me.Subformfield = Forms!Mainformname!Mainformfield

Although which control or form event you would place the code in is not apparent from the limited info in your post.

You might also try using an unbound field on the subform to receive the data. Set its ControlSource as:

=[Forms]![Mainformname]![Mainformfieldname]

then use:

Me.Subformfieldname.Requery
in a Subform control event, or:

Forms!Subformname!Subformfieldname.Requery

in a mainform event.

Rod
 
thank you, thank you, thank you!!!!!!!!!!!!!!!1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top