Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Feb 2002
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    What is the name of the Previous Form (2000)

    I have a form that is called from several different forms...and I need to know where the form is called from. Any suggestions? Thanks

  2. #2
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Nevada, USA
    Posts
    207
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: What is the name of the Previous Form (2000)

    I have faced the same problem and have used the openargs parameter of the calling form to accomplish this. I pass a unique code (unique, that is, to the calling form) to the called form. The code will be available in the called form in openargs.

    In other words, if A and B both call C, I would use something like:

    DoCmd.OpenForm "C", , , , , , strCode

    in both forms A and B. In form A, strCode would contain "A" and in form B, it would contain "B". Once C opens, openargs would contain either "A" or "B" depending on which form opened it.

    HTH.
    Carol W.

  3. #3
    New Lounger
    Join Date
    Feb 2002
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: What is the name of the Previous Form (2000)

    Thanks. I've been using the same procedure...but, I am looking for a cleaner solution..

  4. #4
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Nevada, USA
    Posts
    207
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: What is the name of the Previous Form (2000)

    That's the only method that I know of. Perhaps someone else has a more elegant solution.
    Carol W.

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: What is the name of the Previous Form (2000)

    It isn't necessarily more elegant, but the method I generally use is to create a module level public variable named CalledFrom for each form. This is a string variable and making it public effectively makes it a property of the form which can be read and written to from outside the form.

    So if you pass a value in the OpenArgs, it could be written to CalledFrom from inside the form, or the form that opens that form could set it in code.
    Charlotte

Posting Permissions

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