Form close itself?

S

SirPoonga

Can I have a form close itself at the end of a function? Like if I
make a close button?
I tried Unload Me but that produced an error.
 
A

Andi Mayer

Can I have a form close itself at the end of a function? Like if I
make a close button?
I tried Unload Me but that produced an error.

this is VB

in Access: docmd.close acform, Me.name
 
M

[MVP] S.Clark

At the end of the code for the button, you can use:

Docmd.Close acForm, Me.Name

Trying to close something while Unloading it is too late. The close is
already in motion, so telling it to close again doesn't do anything
productive.
 
J

John Vinson

Can I have a form close itself at the end of a function? Like if I
make a close button?
I tried Unload Me but that produced an error.

The syntax is

DoCmd.Close acForm, Me.Name

John W. Vinson[MVP]
 
Top