[AccessD] Data Update

Heenan, Lambert Lambert.Heenan at aig.com
Wed Dec 30 10:24:33 CST 2015


Opening a form which is Modal does not prevent the calling code form continuing to execute.

E.g. if From1 has a button to open Form2, and From2 is Modal, then when you run this code on Form1...

Private Sub Command0_Click()
    DoCmd.OpenForm "Form2"
    MsgBox "After Form Open"
End Sub

The MsgBox will be displayed right after From2 shows up. It is Modal, and so keeps the focus, but the code keeps on running.

Whereas,

Private Sub Command0_Click()
    DoCmd.OpenForm "Form2", WindowMode:=acDialog
    MsgBox "After Form Open"
End Sub

Results in Form2 showing up, but the Msgbox does not appear until From2 is closed *regardless* of whether it is modal or not.


So, returning to your original question: 

Forget about focus, forget about event procedures.  Open the second form in Dialog mode (with or without the Modal setting). Let the user do the edits, and save them. Then when the second form closes use whatever code you originally used when you loaded the first form to repopulate the first form's data.

Lambert

-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bob Heygood
Sent: Wednesday, December 30, 2015 11:03 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Data Update

Sorry, yes, it always was modal.



-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert
Sent: Wednesday, December 30, 2015 7:44 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Data Update


Have you tried my acDialog suggestion?

Lambert

       |
   \   *  ./
  .  * * * .    ♪ღ♪*•.¸¸¸.•*¨(¯`’•.¸(♥)¸.• ’´¯)¨*•.¸¸¸.•*•♪ღ♪•**•.•.¸(♥)¸.• ’´¯)
-=*  POP! *=-       ░H░A░P░P░Y░░░N░E░W░░Y░E░A░ R░░2016░░ .  .* * *  .   ♪ღ♪*•.¸¸¸.•*¨(¯`’•.¸(♥)¸.• ’´¯)¨*•.¸¸¸.•*•♪ღ♪•**•.•.¸(♥)¸.• ’´¯)
  /    *  .\
 

--
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



More information about the AccessD mailing list