Sub OpenFormAndWait()
' Open the form in dialog mode
DoCmd.OpenForm "YourFormName", WindowMode:=acDialog
' Code here will execute after the form is closed
MsgBox "The form has been closed. Continuing with the code..."
End Sub
from copilot help
Keep document that easy to find