Full Version: Code Questions: Referencing a Main form text box in Subform VBA
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
jodidew
I am very confused about how to code this. It seems like every book is telling me different things and nothing is working.

I have 3 text boxes. On the mainform there is textbox1. And on the Subform there is Textbox2 and textbox3.

I would like to code in the subform the following:

if textbox2 > 60 then
textbox3 = 10 + textbox1
end if

I dont know how to call textbox1 from the main form. Any help???

Actual Code in subform
Private Sub SV10ml_Count_AfterUpdate()
If Me.SV10ml_Count > 60 Then
Me.SubVolume = 10 + ___________________
End If
End Sub
Jack Cowley
This article should answer your question about referring to controls on forms/subforms.

hth,
Jack
R. Hicks
Try referring to the texbox in the main form from the subform as:

Me.Parent.textbox1

RDH
jodidew
Great reference. I am printing that one. Thanks!!
Jack Cowley
You are welcome.

Jack
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.