Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2010
    Posts
    12

    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?

  2. #2
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    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

    DoCmd.OpenForm GlobalVariableName

    Just don't forget to close the Organization form with the DoCmd.Close command.

    SL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •