How to make the Modal Form closed first, and then run codes after its opening-Form-command?

%3CLINGO-SUB%20id%3D%22lingo-sub-1165659%22%20slang%3D%22en-US%22%3EHow%20to%20make%20the%20Modal%20Form%20closed%20first%2C%20and%20then%20run%20codes%20after%20its%20opening-Form-command%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1165659%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%20I%20am%20new%20to%20this%20Access%20community%2C%20and%20need%20your%20expertise%20to%20fix%20my%20problem%20during%20developing%20an%20Access%20application.%3C%2FP%3E%3CP%3EI%20designed%20the%20pop-up%20and%20Modal%20form%20to%20first%20get%20user%20to%20input%20a%20file%20name%20and%20its%20file%20folder%20name%2C%20and%20then%20export%20the%20search%20result%20to%20that%20file.%20My%20problem%20is%20after%20opening%20the%20modal%20form%2C%20the%20Access%20continually%20executes%20the%20codes%20after%20its%20open-modal-form%20command%20(DoCmd.OpenForm).%20I%20wanted%20to%20wait%20for%20that%20the%20modal%20form%20is%20closed%20first%2C%20and%20then%20run%20the%20codes%20after%20the%20open-modal-form%20command.%3C%2FP%3E%3CP%3EI%20very%20appreciate%20your%20advice.%3C%2FP%3E%3CP%3EThanks%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDingChen%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1165659%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAccess%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1165726%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20make%20the%20Modal%20Form%20closed%20first%2C%20and%20then%20run%20codes%20after%20its%20opening-Form-command%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1165726%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F552776%22%20target%3D%22_blank%22%3E%40DingChen018%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20fixed%20the%20problem%20because%20I%20didn't%20set%20right%20parameters%20as%20follows.%3C%2FP%3E%3CP%3EDoCmd.OpenForm%20%22frmInputFileName%22%2C%20acNormal%2C%20%2C%20%2C%20%2C%20acDialog%3C%2FP%3E%3CP%3Enow%20the%20modal%20form%20is%20keeping%20open%20until%20it%20is%20closed%2C%20and%20then%20the%20codes%20after%20the%20Open-Form%20command%20are%20executed.%3C%2FP%3E%3CP%3EThanks%20for%20your%20review.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

Hello, I am new to this Access community, and need your expertise to fix my problem during developing an Access application.

I designed the pop-up and Modal form to first get user to input a file name and its file folder name, and then export the search result to that file. My problem is after opening the modal form, the Access continually executes the codes after its open-modal-form command (DoCmd.OpenForm). I wanted to wait for that the modal form is closed first, and then run the codes after the open-modal-form command.

I very appreciate your advice.

Thanks,

 

DingChen

1 Reply
Highlighted

@DingChen018 

I fixed the problem because I didn't set right parameters as follows.

DoCmd.OpenForm "frmInputFileName", acNormal, , , , acDialog

now the modal form is keeping open until it is closed, and then the codes after the Open-Form command are executed.

Thanks for your review.