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)
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With