Chris said:
I have a main form with a subform on it. On the main form i have a couple text boxes with data in them. On the subform i have a text box that when i enter a number I want it to pull the correct value from one of the boxes on the main form but i cant seem to call that me.textbox on the main form from my subform. Does this have to be a module with a public function so i can call it across forms? I have never used a module, what is involved?
Slip of the mouse, sorry.
Anyway, you can refer to a control in the parent form using
VBA with this syntax in the subform's module:
Me.Parent.mainformtextbox
You do not need a special function to do this, but you do
have to place the reference in a statement that's in an
appropriate event procedure. It sounds like you eill
probably want it in the subform text box's AfterUpdate event
procedure. For example, you might use something like this
in the txtQuantity text box's AfterUpdate event:
Me.txtTotalPrice = Me.txtQuantity * Me.Parent.txtUnitPrice