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)Answer1:
DoCmd.Close expects <em>ObjectType</em> as its first argument, followed by <em>ObjectName</em> 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 ...<pre class="lang-vb prettyprint-override">
DoCmd.Close acForm, Me.Name