Jim Lawrence
accessd at shaw.ca
Wed Aug 30 14:15:52 CDT 2006
Hi Borge: In order to run/spawn another running form and/or processed you will have to run a do event process. See example below: Private Sub MyList_DblClick() Dim bolFormOpen as Boolean ... bolFormOpen = True DoCmd.OpenForm "MyCalledForm" Do while bolFormOpen = true Do While globalBooleanFlag = True DoEvents Loop bolFormOpen = IsLoaded("MyCalledForm") If bolFornOpen = True then AddAnotherRecordtoaTable() End if globalBooleanFlag = bolFormOpen Loop End Sub ... Public Function IsLoaded(ByVal strFormName As String) As Boolean Dim bolStatus as Boolean Const conObjStateClosed = 0 Const conDesignView = 0 bolStatus = False If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> conObjStateClosed Then If Forms(strFormName).CurrentView <> conDesignView Then bolStatus = True End If End If IsLoaded = bolStatus End Function Upon initialization the form MyCalledForm it sets the variable globalBooleanFlag to TRUE, within the called Form, it can spawn an external process by setting it to FALSE and holds the caller processing, in the subroutine to the current position until the Form MyCalledForm is closed. If you expand on this "a little more complex than I wanted to have" example, you can have a number of forms opened and various processes running. Also check out WithEvents example by John, http://www.databaseadvisors.com/newsletters/newsletter052002/0205CombiningRa iseEvents%20.htm and Shamil http://smsconsulting.spb.ru/shamil_s/articles.htm which describes similar functionality using the WithEvent clause. HTH Jim -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of paul.hartland at fsmail.net Sent: Wednesday, August 30, 2006 7:59 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Accessing AfterUpdate Event from another procedure Importance: High I too am unsure what your trying to do but you would need to use a call statement....I know you can call events in the same form your working in, but as for another form I don't know if it would work....you could always try CALL Forms![frmControl].cboNav_AfterUpdate As I say I don't know if it would work, but surely there could be a better solution.. Paul Message Received: Aug 30 2006, 03:50 PM From: "Charlotte Foust" To: "Access Developers discussion and problem solving" Cc: Subject: Re: [AccessD] Accessing AfterUpdate Event from another procedure It isn't clear to me what you're trying to accomplish with this. Perhaps you could explain it in overview, not the specifics but what you hope to achieve as a result. I still think trying to call the afterupdate event of a combobox on another form is going the long away around to get nowhere. Charlotte Foust -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Borge Hansen Sent: Tuesday, August 29, 2006 7:16 PM To: Access Developers discussion and problem solving Subject: [AccessD] Accessing AfterUpdate Event from another procedure Hmmmm... I always seem to get stuck when attempting to access and run code in an afterupdate event when trying to call and execute the event from another procedure in another module than the Form module the afterupdate event code resides in.... So what are the clear cuts on this.... please See the code snippet below Regards Borge /Code snippet: If FIsLoaded("frmSystem") Then If FIsLoaded("frmControl") Then Dim strSecName As String Dim boolModuleNamePresent As Boolean strSecName = Forms("frmSystem")("SecName") boolModuleNamePresent = DLookup("Screen1", "tblSystem", "SecName = '" & strSecName & "'") If boolModuleNamePresent Then Dim frm As Form Dim ctrl As ComboBox Set frm = Forms!frmControl Set ctrl = frm!cboNav ctrl.Value = "Clients" 'just for testing - tests ok! Dim vValue0 Dim vValue1 Dim vValue2 Dim vValue3 Dim vValue4 vValue0 = ctrl vValue1 = ctrl.Column(1) vValue2 = ctrl.Column(2) vValue3 = ctrl.Column(3) vValue4 = ctrl.Column(4) 'end just for testing 'HERE: how do I call the AfterUpdate event of cboNav in the open form called frmControl ?? ' cboNav_AfterUpdate to execute here Set frm = Nothing Set ctrl = Nothing Else MyMsgBox "You do not have access to the Clients Module" & vbCrLf & "Please see the System Administrator about this!", vbInformation End If Else MyMsgBox "This Form requires frmControl to be loaded!", vbCritical End If Else MyMsgBox "This Form requires frmSystem to be loaded!", vbCritical End If -- 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