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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to close a userform 1

Status
Not open for further replies.

AncientTiger

Programmer
Jul 5, 2001
238
US
This SHOULD be simple, but how do you CLOSE a userform using script, instead of just hiding it?? I've tried myuserform.close, and myuserform.terminate.... both don't work....

 
try calling the method instead of the action...

DoCmd.Close [objecttype, objectname], [save]

objecttype is an intrinsic constant (probally acForm for you)

the default constant acSavePrompt is initiated if the the save argument is left blank but you could also use acSaveNo or acSaveYes depending on what you want to do.

if this is the default or active form that you are closing then you can leave all those arguments blank and just go with DoCmd.Close

Eric

 
To close a userform in VBA, I use the "Hide" method and the "Unload" keyword.

Example:
UserForm1.Hide
Unload UserForm1

Hope this helps,
Pete
 
BY JOVE! I do believe that's got it!!

Thanks a ton uberpudge!
 
sorry...your right...

Have you tried to 'unload' it. I am fairly sure there is a .unload statement that removes it from memory.

eric
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top