Calling an event from a separate form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My Afterupdate event doesn't fire since I'm inserting a value into the combo
field programatically. After researching the archives, I see that the
suggestion is to call the event using code similar to this:

- Forms!frmNameofForm.NameofControl_Nameofevent (with or without the key
word Call in front of the sequence - it doesn't seem to matter - other than
causing a red highlight on the code implying something is wrong when the word
Call is put in front)

- and also set the event to be called as a Public subprocedure - which I did.

My situation is a bit more complicated since the control which has the event
is on a subform. The main form is frmProspectMain. The subform is
frmProspAddr. The control (combo) on the subform is ApartmentID.

The form from which I'm attempting to call this public event is called
frmApartmentInsert. What I tried underlying a command button on that form
was:

Forms!frmProspectMain!frmProspAddr.ApartmentID_AfterUpdate - but I get an
error message stating "Object doesn't support this property or method"

Any suggestions would be greatly appreciated.

Cheers,
Jody
 
Jody said:
My Afterupdate event doesn't fire since I'm inserting a value into
the combo field programatically. After researching the archives, I
see that the suggestion is to call the event using code similar to
this:

- Forms!frmNameofForm.NameofControl_Nameofevent (with or without the
key word Call in front of the sequence - it doesn't seem to matter -
other than causing a red highlight on the code implying something is
wrong when the word Call is put in front)

- and also set the event to be called as a Public subprocedure -
which I did.

My situation is a bit more complicated since the control which has
the event is on a subform. The main form is frmProspectMain. The
subform is frmProspAddr. The control (combo) on the subform is
ApartmentID.

The form from which I'm attempting to call this public event is called
frmApartmentInsert. What I tried underlying a command button on that
form was:

Forms!frmProspectMain!frmProspAddr.ApartmentID_AfterUpdate - but I
get an error message stating "Object doesn't support this property or
method"

Any suggestions would be greatly appreciated.

Probably all you need to do is include the Form property of the subform
in the reference:

Forms!frmProspectMain!frmProspAddr.Form.ApartmentID_AfterUpdate

Does that work?
 
Works perfectly! Thanks Dirk.....

Dirk Goldgar said:
Probably all you need to do is include the Form property of the subform
in the reference:

Forms!frmProspectMain!frmProspAddr.Form.ApartmentID_AfterUpdate

Does that work?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
Back
Top