Drew Wutka
DWUTKA at marlow.com
Tue Apr 8 15:38:14 CDT 2003
Right, in your parent form you should have: Dim WithEvents sfrm as Form_subfrmTest Private Sub Form_Load() Set sfrm=Me.MySubForm.Form End Sub Private Sub sfrm_MySpecialEvent() 'Do something End Sub Dimensioning a variable as a sub form, using the WithEvents does allow you to code for an event. However, until that form is set to an actual object, it is not going to do anything. The line I have in the Load event is what sets that variable to represent the Form's subform. After that point, then events raised by the subform will be fired by the main form. Drew -----Original Message----- From: Charlotte Foust [mailto:cfoust at infostatsystems.com] Sent: Tuesday, April 08, 2003 3:05 PM To: accessd at databaseadvisors.com Subject: RE: [AccessD] RaiseEvent from subform to Parent Never mind, I figured it out. I had forgotten to declare the withevents object in the parent form as the specific Form_MySubformName. Blame it on advanced age and mental deterioration ... And Windows XP. <G> Charlotte Foust -----Original Message----- From: Charlotte Foust Sent: Tuesday, April 08, 2003 11:54 AM To: accessd at databaseadvisors.com Subject: RE: [AccessD] RaiseEvent from subform to Parent Yes. Drew. But my parent form seems to be blind. <vbg> Charlotte Foust -----Original Message----- From: Drew Wutka [mailto:DWUTKA at marlow.com] Sent: Tuesday, April 08, 2003 11:48 AM To: 'accessd at databaseadvisors.com' Subject: RE: [AccessD] RaiseEvent from subform to Parent Right, you declare the event on the object you want to have the event fire FOR, but you use the WithEvents statement on the object you want to 'SEE' the event. Drew -----Original Message----- From: Charlotte Foust [mailto:cfoust at infostatsystems.com] Sent: Tuesday, April 08, 2003 2:33 PM To: accessd at databaseadvisors.com Subject: RE: [AccessD] RaiseEvent from subform to Parent I did, Drew, but the custom event has to be declared on the subform unless I've totallly lost my mind.(no wisecracks, please) And for some reason RaiseEvent doesn't seem to be working. Charlotte Foust -----Original Message----- From: Drew Wutka [mailto:DWUTKA at marlow.com] Sent: Tuesday, April 08, 2003 11:10 AM To: 'accessd at databaseadvisors.com' Subject: RE: [AccessD] RaiseEvent from subform to Parent If I read your post right, you need to declare the subform on the main form with the 'withevents' statement, not the other way around. Drew -----Original Message----- From: Charlotte Foust [mailto:cfoust at infostatsystems.com] Sent: Tuesday, April 08, 2003 1:21 PM To: AccessD at databaseadvisors.com Subject: [AccessD] RaiseEvent from subform to Parent I'm trying to raise a custom event from an XP subform to its parent form without any luck. The event is declared public in the subform, is being raised with the appropriate argument, and the parent form declared and instantiated an object WithEvents, but the equivalent event procedure in the parent form never fires. Is this something that just can't be done or have I missed a step somewhere? JC? Charlotte Foust _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com