Unload Me

J

Jac Tremblay

Hi,
I have a form loaded as Modal and on the Cancel Button event, I want it to
close (or unload).

Private Sub cmdAnnuler_Click()
MsgBox "me.Name = " & Me.Name ' To make sure it is the right one.
Unload Me
End Sub
I get an error:
Run-time error '361':
Can't load or unload this object

What is the problem?
Thanks
 
M

Marshall Barton

Jac said:
I have a form loaded as Modal and on the Cancel Button event, I want it to
close (or unload).

Private Sub cmdAnnuler_Click()
MsgBox "me.Name = " & Me.Name ' To make sure it is the right one.
Unload Me
End Sub
I get an error:
Run-time error '361':
Can't load or unload this object

You need to use the Close method with Access forms.

DoCmd.Close acForm, Me.Name, acSaveNo

Check VBA Help for details.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top