Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to close (unload) a form

Tags:

vba

ms-access

I have a form that has some buttons, and when user click on a button, the form should be closed (unloaded). I used the following methods, but all generate error:

docmd.close me

unload me

What is the best way to close or unload a form in VBA (from code inside the form)

like image 759
mans Avatar asked Oct 19 '14 16:10

mans


1 Answers

DoCmd.Close expects ObjectType as its first argument, followed by ObjectName which is a variant string as the object name.

So in the click event of a command button which is intended to close the current form, I use this ...

DoCmd.Close acForm, Me.Name
like image 137
HansUp Avatar answered Sep 25 '22 05:09

HansUp