Listening for events on subform nested in a tab control

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
 
M

Mark A. Sam

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
 

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