Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the best way to wait for a Form to be closed in MS Access VBA?

I call a Form from a module, and would like to wait for the Form to be closed before completing the rest of that module. What is a proper way to do the waiting?

I have an IsOpen("formname") function to check to see if the Form is still open.

like image 437
Lance Roberts Avatar asked Jun 22 '11 21:06

Lance Roberts


1 Answers

set WindowMode:=acDialog when you initiate DoCmd.OpenForm

Here is how it is done from other Office VBA (Excel, Word, VB6, VB.Net) Call the form modally using the following code

Dim f as new FormNameHere
f.Show True  'True is the option for Dialog in VB
' form will be displayed until the user dismisses it then execution continues
set f = Nothing

Otherwise:

f.ShowDialog
like image 140
Ahmad Avatar answered Sep 25 '22 12:09

Ahmad