Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Whoa! Wait for me, big fella!


Message #1 by "Gregory Serrano" <SerranoG@m...> on Wed, 22 May 2002 13:13:10
I have an "After Update" event on an text box that includes opening 
another form (as modal / dialog) and reading some data.  Upon reading data 
from that second form, the second form closes and the "After Update" event 
is supposed to continue using that data to do something else.

Private Sub txtTextBox_AfterUpdate()

   {do stuff here}   

   DoCmd.OpenForm "frmMyForm"

   {do more stuff here using data from frmMyForm}

End Sub

The problem is that the procedure is not waiting for the data input from 
frmMyForm.  It's doing the first stuff, opening frmMyForm, and doing the 
second stuff without waiting for frmMyForm to close first.  I thought 
making frmMyForm modal would give me the effect I want, but it's not.  Any 
ideas?

Greg
Message #2 by joe.dunn@c... on Wed, 22 May 2002 14:01:10 +0000
Greg's query:

The problem is that the procedure is not waiting for the data input from
frmMyForm.  It's doing the first stuff, opening frmMyForm, and doing the
second stuff without waiting for frmMyForm to close first.  I thought
making frmMyForm modal would give me the effect I want, but it's not


The function below will cycle until the named form (the first one) closes.
You can use this function or put the key lines (the Do While.....Loop) into
your code

When the first file closes, the function will complete (or your code exits
the loop) and you can carry on!


Public Sub WaitForFormClose(pForm As String)
' Comments  : waits for a named form to close
' Accepts   : pForm - name of the form
' Returns   : nothing

  Do While SysCmd(acSysCmdGetObjectState, acForm, pForm) <> 0
    DoEvents
  Loop

End Sub

*************************************************************************

This e-mail may contain confidential information or be privileged. It is intended to be read and used only by the named
recipient(s). If you are not the intended recipient(s) please notify us immediately so that we can make arrangements for its return:
you should not disclose the contents of this e-mail to any other person, or take any copies. Unless stated otherwise by an
authorised individual, nothing contained in this e-mail is intended to create binding legal obligations between us and opinions
expressed are those of the individual author.

The CIS marketing group, which is regulated for Investment Business by the Financial Services Authority, includes:
Co-operative Insurance Society Limited Registered in England number 3615R - for life assurance and pensions
CIS Unit Managers Limited Registered in England and Wales number 2369965  - for unit trusts and PEPs
CIS Policyholder Services Limited Registered in England and Wales number 3390839 - for ISAs and investment products bearing the CIS
name
Registered offices: Miller Street, Manchester M60 0AL   Telephone  0161-832-8686   Internet  http://www.cis.co.uk   E-mail
cis@c...

CIS Deposit and Instant Access Savings Accounts are held with The Co-operative Bank p.l.c., registered in England and Wales number
990937, P.O. Box 101, 1 Balloon Street, Manchester M60 4EP, and administered by CIS Policyholder Services Limited as agent of the
Bank.

CIS is a member of the General Insurance Standards Council

CIS & the CIS logo (R) Co-operative Insurance Society Limited

********************************************************************************
Message #3 by "Leo Scott" <leoscott@c...> on Wed, 22 May 2002 08:26:52 -0700
DoCmd.OpenForm "frmMyForm", windowmode:=acDialog

|-----Original Message-----
|From: Gregory Serrano [mailto:SerranoG@m...]
|Sent: Wednesday, May 22, 2002 1:13 PM
|To: Access
|Subject: [access] Whoa! Wait for me, big fella!
|
|
|I have an "After Update" event on an text box that includes opening
|another form (as modal / dialog) and reading some data.  Upon reading data
|from that second form, the second form closes and the "After Update" event
|is supposed to continue using that data to do something else.
|
|Private Sub txtTextBox_AfterUpdate()
|
|   {do stuff here}
|
|   DoCmd.OpenForm "frmMyForm", windowmode:=acDialog
|
|   {do more stuff here using data from frmMyForm}
|
|End Sub
|
|The problem is that the procedure is not waiting for the data input from
|frmMyForm.  It's doing the first stuff, opening frmMyForm, and doing the
|second stuff without waiting for frmMyForm to close first.  I thought
|making frmMyForm modal would give me the effect I want, but it's not.  Any
|ideas?
|
|Greg


  Return to Index