How do I pass form object to VBA

petebob796

Registered User.
Local time
Today, 18:32
Joined
Jul 31, 2007
Messages
27
How do I pass the form object to VBA from an OnClick button action. I originaly had:
(onclick event) =closeForm("the name of the from")

then

Public Function closeForm(formUsed As string)
//do some data checking here
DoCmd.Close acForm, formUsed
End Function


but I wish to change it to
=closeForm(FormObject)

Public Function closeForm(formUsed As Form)//do some data checking here
DoCmd.Close acForm, formUsed.Name
End Function


so that I don't have to hard code the form names. I tried =closeForm(Me) which errored I think its something quite simple but can't think of it.
 

Users who are viewing this thread

Back
Top Bottom