none
How can access from subform to main form through vba RRS feed

  • Question

  • Hi, everyone

    I get a question about accessing from a subform control to main form control through vba.

    NOTE: I know access from main form to subform (Forms!main_form![sub_form].Form![control_from_sub_form]properties)
    Wednesday, February 6, 2013 4:14 PM

Answers

  • Hi EMHO

    "EMHO" schrieb im Newsbeitrag news:a27164af-0cd9-4bb6-b7ed-ef2463e2e025@communitybridge.codeplex.com...

    I get a question about accessing from a subform control to main form control through vba.

    Dim ctl As Control
    Set ctl = Me.Parent!YourControl

    should do the trick. Or if you just want to read a value - in for example a textbox - on the mainform

    Dim varText As Variant
    varText = Me.Parent!yourTextbox

    HTH
    Henry

    • Marked as answer by EMHO Thursday, February 7, 2013 8:38 PM
    Thursday, February 7, 2013 4:27 AM

All replies

  • Not really sure if this question is in the right forum. Maybe this is a better place to get an anwser ( http://social.msdn.microsoft.com/forums/en/isvvba/threads ).

    But what if you look at subform.Parent or recursivly get parents untill you get the Form you want? (I dont know anything about vba though, so my anwser might be complelty off)


    Anze Javornik

    Wednesday, February 6, 2013 10:44 PM
  • Hi EMHO

    "EMHO" schrieb im Newsbeitrag news:a27164af-0cd9-4bb6-b7ed-ef2463e2e025@communitybridge.codeplex.com...

    I get a question about accessing from a subform control to main form control through vba.

    Dim ctl As Control
    Set ctl = Me.Parent!YourControl

    should do the trick. Or if you just want to read a value - in for example a textbox - on the mainform

    Dim varText As Variant
    varText = Me.Parent!yourTextbox

    HTH
    Henry

    • Marked as answer by EMHO Thursday, February 7, 2013 8:38 PM
    Thursday, February 7, 2013 4:27 AM