Henry Simpson
hsimpson88 at hotmail.com
Thu Aug 28 12:27:50 CDT 2003
Public Function PopupCalendar(txt As TextBox) As Variant .... Eval ("Forms('" & txt.Parent.Name & "')." & txt.Name & "_AfterUpdate") .... For some reason it calls the event procedure twice when I tried it. Presumably you are using a function so that you can put the function name in place of [Event Procedure] in the control property sheet. I have never found a need to return a variant or anything else for that matter. Are you passing in the textbox parameter as (screen.activecontrol)? This seems to make good sense when using a guaranteed focus event such as a click or double click. Hen >From: "Dan Waters" <dwaters at usinternet.com> >Reply-To: Access Developers discussion and problem >solving<accessd at databaseadvisors.com> >To: "Database Advisors" <accessd at databaseadvisors.com> >Subject: [AccessD] Calling an AfterUpdate Event in a different form. >Date: Thu, 28 Aug 2003 10:17:31 -0500 > >Is this possible? > >I have a calendar form that is triggered by double-clicking in a date >field. >Putting the date into the correct field works fine, but I need to be able >to >trigger the AfterUpdate event for whatever date field is on whatever form, >and I haven't been able to figure this out. The AfterUpdate event is >Public. The associated code is below, and is in a standard module: > > >Public Function PopupCalendar(txt As TextBox) As Variant >On Error GoTo EH > > [IN THIS EXAMPLE, txt = txtDateStart FROM THE CALLING FORM] > > Dim frmCal As Form > Dim varStartDate As Variant > Dim frmParent As Form > Dim stgParent As String > Dim stgAfterUpdateEvent As String > > If IsNull(txt.Value) Then > varStartDate = CurrentDate > Else > varStartDate = txt.Value > End If > > DoCmd.OpenForm "frmCalendar", , , , , acDialog, varStartDate > > If IsFormLoaded("frmCalendar") = True Then > Set frmCal = Forms("frmCalendar") > txt.Value = Format(DateSerial(frmCal!Year, frmCal!Month, >frmCal!Day), "m/d/yy") > > stgParent = txt.Parent.Name > Set frmParent = Forms(stgParent) > stgAfterUpdateEvent = txt.Name & "_AfterUpdate" > > Call frmParent.stgAfterUpdateEvent [THIS IS WHAT I WANT - >BUT >NO DICE!] > > Call frmParent.txtDateStart_AfterUpdate [THIS WORKS, BUT WOULD >NEED A CASE FOR EVERY FIELD!] > > DoCmd.Close acForm, "frmCalendar" > Set frmCal = Nothing > End If > > Exit Function > >EH: > Application.Echo True > Call GlobalErrors("", Err.Number, Err.Description, CurrentObjectName, >"PopupCalendar", txt) > >End Function > > > >_______________________________________________ >AccessD mailing list >AccessD at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/accessd >Website: http://www.databaseadvisors.com _________________________________________________________________ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963