Unanswered: Button that returns user to previous open form
I'm working on a db that tracks actionable items for an office department. I'd like to be able to get to some forms from multiple locations/forms and then be able to automatically return to the previously viewed form without having to create separate forms/buttons/macros that only specify one form.
Here's an example:
I have a form that allows you to input a new organization a worker belongs to. I want to be able to get to this form from the New Worker form, the Switchboard, the New Task Form and an Administration form without having to create 4 forms and buttons that correspond to reversing the path that got me to that form in the first place.
Is there a code I can put under a button that will return me to the last open form as well as refresh that form to reflect the new information that was just entered?
Sounds easy enough. When you open the Organization form, say from the Worker Form, with the DoCmd.OpenForm method, simply include the name of the calling form in the OpenArgs argument, which is the last argument. When you open the form, immediately store the OpenArgs (Me.OpenArgs) in a global variable. To return to the Worker Form, simply use the command
Just don't forget to close the Organization form with the DoCmd.Close command.