Search code examples
ms-accesstabcontrolsubform

How do I reference controls on different subforms in a tab control?


So I have a tab control with a subform on each page. I'm trying to add values from several different textboxes on each subform. I have no problem referencing the textboxes and getting a total on the same subforme, example (= txtOne + txtTwo). However, I'm having problems trying to reference the textboxes on the other subforms in the tab control. I'm sure it's just a syntax issue. Keep getting a Name? error.

Thank you for your help.


Solution

  • From one subform to reference an object on a sister subform, visit the parent object (the main form):

    OtherValue = Me.Parent!NameOfSisterSubformControl.Form!OtherControl.Value
    

    Edit - as expression:

    =[txtOne]+[txtTwo]+[txtThree]+[Parent]![subFormControlName].[Form]![txtFour]