0

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.

2

2 Answers 2

0

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] 
Sign up to request clarification or add additional context in comments.

5 Comments

Still getting the same error. Page 3 on tab control has subform3.txtTotal. I'm adding =txtOne + txtTwo on subform3 and the total is coming out fine. When I add in another control (txtThree) from subform1 on page1 in the tab control using your suggestion, still getting a name? error.
=[txtOne]+[txtTwo]+[txtThree]+[Forms]![MainForm]![subForm].[Form]![txtFour]
I'm putting the above code in the control source of txtTotal
That was not what I wrote. I've edited the answer to include the style for an expression. Do note, that [Form] must be entered with your localised name for a Form object - could be Formular, and the it is name of the subform control to use, not the name of the subform object.
Thank you so much for your help. I'm not thinking of the subform as an actual control, only as a form.
0

I figured it out. The controls are bound to a table and I just referenced that instead of the actual name of the control.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.