Mark A Matte
markamatte at hotmail.com
Fri Dec 29 12:04:47 CST 2006
Thank You All for the feedback. It worked like a charm.
Thanks,
Mark A. Matte
>From: "A.D.TEJPAL" <adtp at airtelbroadband.in>
>Reply-To: Access Developers discussion and problem
>solving<accessd at databaseadvisors.com>
>To: "Access Developers discussion and problem
>solving"<accessd at databaseadvisors.com>
>Subject: Re: [AccessD] Call SubForm Event Procedure
>Date: Fri, 29 Dec 2006 23:10:03 +0530
>
>Mark,
>
> The target procedure in a form or subform, that you wish to call
>externally should be made public.
>
> In sample code given at (A) & (B) below, if CmdMainMaster located on
>the parent form is clicked, it will execute the click event of CmdSubSlave
>on the subform. Similarly, if CmdSubMaster located on the subform is
>clicked, it will execute the click event of CmdMainSlave on the main form.
>
> Important:
> (a) While calling a subform's public subroutine from code in main
>form's module, use of Form. qualifier is essential. On the other hand,
>while calling main form's public subroutine from code in subform's module,
>use of Form. qualifier is to be AVOIDED.
> (b) Similar precaution is applicable while triggering the events
>on a form or its subform, via code located in an external form's module,
>for example (F_Main is the name of main form while SF_Sub is the name of
>subform control acting as container for the subform):
> (1) Call main form's public event via code in external form:
> Forms("F_Main").CmdMainSlave_Click
> (2) Call subform's public event via code in external form:
> Forms("F_Main")("SF_Sub").Form.CmdSubSlave_Click
>
>
> My sample db named FormsSubformsReference might also be of interest to
>you. It is available at Rogers Access Library (other developers library).
>Link - http://www.rogersaccesslibrary.com/OtherLibraries.asp#Tejpal,A.D.
>
>Best wishes,
>A.D.Tejpal
>---------------
>
>A) Code in main form's module
>(SF_Sub is the name of subform control
>acting as container for the subform)
>============================
>Private Sub CmdMainMaster_Click()
> Me.SF_Sub.Form.CmdSubSlave_Click
>End Sub
>
>Public Sub CmdMainSlave_Click()
> MsgBox "CmdMainSlave"
>End Sub
>============================
>
>B) Code in subform's module
>============================
>Private Sub CmdSubMaster_Click()
> Me.Parent.CmdMainSlave_Click
>End Sub
>
>Public Sub CmdSubSlave_Click()
> MsgBox "CmdSubSlave"
>End Sub
>============================
>
> ----- Original Message -----
> From: Mark A Matte
> To: accessd at databaseadvisors.com
> Sent: Friday, December 29, 2006 03:07
> Subject: [AccessD] Call SubForm Event Procedure
>
>
> Hello All,
>
> I have an OnCurrent event on a subform. Can I call, or cause to fire
>from the main form.
>
> Thanks,
>
> Mark A. Matte
>--
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com
_________________________________________________________________
Find sales, coupons, and free shipping, all in one place! MSN Shopping
Sales & Deals
http://shopping.msn.com/content/shp/?ctid=198,ptnrid=176,ptnrdata=200639