Lance Roberts
Lance Roberts

Reputation: 22842

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.

Upvotes: 5

Views: 9120

Answers (1)

Ahmad
Ahmad

Reputation: 12737

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

Upvotes: 5

Related Questions