I have a function within a module that opens my Home Page Form:
Function goto_home()
Dim stDocName As String
'DoCmd.Close acForm, "CallingForm.Name" , acSaveYes
stDocName = "home_page"
DoCmd.OpenForm stDocName
End Function
It’s in a module because I have command buttons on all my forms that use the code instead of duplicating it within each Form Object.
The commented line in my code should close the calling form before the home page is opened. If I was doing it from a form object I would use me.form.name but you can’t do that in a module.
Is there an equivalent module syntax that allows reference to the Calling Form?
You could always pass the formname in the function e.g:
Then as you are calling this from each form, you can put the form’s name in the call argument.