By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,972 Members | 911 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,972 IT Pros & Developers. It's quick & easy.

Use a field from Main form in subform

P: n/a
Is there a way I can grab a value from my main form and use it in a
calculation on a subform?
Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a

"chris vettese" <ch**********@yahoo.com> escreveu na mensagem
news:40**************************@posting.google.c om...
Is there a way I can grab a value from my main form and use it in a
calculation on a subform?


CalculationResult = Forms!MainForm!textbox * 2
Nov 12 '05 #2

P: n/a
Sure. Use the Parent property of the form that is in the subform contorl.

In code in the subform's module, you could refer to a text box named "txt1"
on the main form as:
Me.Parent.txt1

In the ControlSource of a text box, use:
=[Form].[Parent]![txt1]

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"chris vettese" <ch**********@yahoo.com> wrote in message
news:40**************************@posting.google.c om...
Is there a way I can grab a value from my main form and use it in a
calculation on a subform?

Nov 12 '05 #3

P: n/a

"chris vettese" <ch**********@yahoo.com> wrote in message
news:40**************************@posting.google.c om...
Is there a way I can grab a value from my main form and use it in a
calculation on a subform?


From VBA code, you can referece a Control on the parent Form with
Me.Parent!<controlname>. If you want to do it in an expression in the
Control Source, you'd have to use the fully-qualified
Forms!<formnameofparentform>!<controlname> which would limit the use of that
Form that is embedded in the Subform Control to the one parent Form, so it'd
probably be better to use a Control Source that is a user-defined-function
where you can use the "Me.Parent" notation.

Larry Linson
Microsoft Access MVP
Nov 12 '05 #4

P: n/a
Mal
check out help for the Parent property...
I haven't used it much but think that it is something like
me.parent.tctValuefield.value

HTH
Mal.
"chris vettese" <ch**********@yahoo.com> wrote in message
news:40**************************@posting.google.c om...
Is there a way I can grab a value from my main form and use it in a
calculation on a subform?

Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.