Listening for events on subform nested in a tab control

  • Thread starter Thread starter Jim Shaw
  • Start date Start date
J

Jim Shaw

I wish to synchronize a pop up form with events generated
in a subform which is nested on a page in a tab control.

On my subform "MySubForm", located on "MyMainForm", I have
declared a custom event in the global area:
Public Event CurRec(EffectiveDate)
also I have:
Private Sub Form_Current()
RaiseEvent CurrentRec(EffectiveDate)
End Sub

In the global area of "myPopUp" form I have:
Dim WithEvents subComp As Form_MySubForm
Private Sub Form_Load()
Set frmEmp = Forms!frmEmpMaint 'start listening for
NewEmp events
Set subComp = Forms![frmEmpMaint]!MySubForm
End Sub

My problem is coding the proper syntax for the "Set
subComp" statement above. Various versions lead to
messages that generally say the subform can't be found.

Does anyone know how to code this?

Thanks
 
Jim,

I don't know what you are doing with your code, but you this may help you.
Instead of

Forms![frmEmpMaint]!MySubForm

try

Forms![frmEmpMaint].MySubForm

When refering to a subform control use a . (Dot) instead of a ! (Bang)

God Bless,

Mark
 
Back
Top