Calling a main forms text box's change event from a subform

B

Brad Pears

I have a main form that includes a subform. On the update event of the
subform, I want to call the change event for a text box that exists on the
main form.

I have the following code but it errors out with an application defined or
object defined error...

Forms![frmPricing]![frmPricingDetail].Form.txtDiff_Change

(the main form I am referring to is in itself a subform - as you can see
above)

Any idea how I can call the change event of a text box on a different form?
I know I can get around this various other ways but it would be nice to know
anyway...

Thanks,

Brad
 
R

rkc

Brad said:
I have a main form that includes a subform. On the update event of the
subform, I want to call the change event for a text box that exists on the
main form.

I have the following code but it errors out with an application defined or
object defined error...

Forms![frmPricing]![frmPricingDetail].Form.txtDiff_Change

(the main form I am referring to is in itself a subform - as you can see
above)

Any idea how I can call the change event of a text box on a different form?
I know I can get around this various other ways but it would be nice to know
anyway...

What you need to know is that forms that are contained in subform
controls are not members of the Forms collection. They are properties
of the subform control. You have to first reference the Form the
subform control is on. Then the Subform control. Then the Form. Then
the control on the form.
 
T

tina

try

Me.Parent.txtDiff_Change

in the *parent* form's module, make sure that the Change event procedure
starts with

Public Sub

rather than

Private Sub

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top