Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Halting code while a form opens and is used

Status
Not open for further replies.

PreacherUK

Technical User
Sep 26, 2002
156
NL
I'm running code in Access. We reach a point where a form opens and a user hits some buttons. However the code that opens the form continues to run after the form is opened. Is there a way of halting code until the form closes again?

Cheers for any help
 
open the form with the last parameter of the "OpenForm" set to acModal
 
Either make the form that you are opening Modal (Other tab of properties window) or open it as a Dialog e.g.
DoCmd.OpenForm "MyForm", acNormal, , , , acDialog

A modal form will always retain focus until it closes. The line following the DoCmd.OpenForm statement will not execute until the form closes. Using the acDialog parameter will open a not-normally-modal form modally and have the same effect. If the form should always be opened modally, make the Modal proerty true (you won't need the acDialog parameter). If this is a one-off for an otherwise un-modal form, use the acDialog parameter.
 
Cheers Chaps!

This is just what I was looking for. I wasn't aware that modal and acDialog halted the code. I love learning something new everyday :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top