Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2007
    Posts
    18

    Unanswered: Function To Store & Retrieve A Value

    Hi.

    Can anyone help me to define the function(s) that will help me to write this code?
    I have a form that can be accessed from three different sources of the application.
    When the form (X) is about to be opened, I want to store the form name of the form that control is being transferred from.
    When the form (X) is closed, I want to return to the form that initially transferred control to (X). Thanks.

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Well, the simplest thing would be to leave the previous form open underneath this form. Otherwise, you could use OpenArgs to pass the name of the form calling the second form, and use that to open the form back up as the second form closes.
    Paul

  3. #3
    Join Date
    Sep 2007
    Location
    Global Village
    Posts
    185
    The best way is what pbaldy mentioned, by making your form invisible and then visible you do it faster and without need to close and reload the form which takes time and memory, anyhow if you want to close the form then you can declare a public string variable in General Declaration section of one of your modules ( it only works in module level ) and store the first form name on close event in the string variable and use it when closing the second form to open the first form again, this method is good when you have several buttons and each open a form and you want by closing the available form the previous form to be opened.
    <<Never Walk on the Traveled Path, Because it only Leads you to where the Others have been.>>
    Graham Bell

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    ^ Terrible idea. What happens if you have form C?

    Form A. Open form B (stores Form A in your global variable).
    Form B. Open form C (stores Form B in your global variable).
    Form C. Close. (Opens Form B ... correct)
    Form B. Close. (Opens Form B?? ... ermmmm)

    No. Either use OpenArgs or any other way to pass the calling form's name to the form being opened. I personally use the Tag property since I often use OpenArgs for other things ^^
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  5. #5
    Join Date
    Sep 2007
    Location
    Global Village
    Posts
    185
    oops you are all right star, using on close event is wrong but here is an examle which works, I mean if you push the close dutton then it open the latest open form
    Attached Files Attached Files
    <<Never Walk on the Traveled Path, Because it only Leads you to where the Others have been.>>
    Graham Bell

  6. #6
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Does it? ^^
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  7. #7
    Join Date
    Apr 2007
    Posts
    18
    Thank you everyone.
    Because i am already using the OpenArgs for another purpose, I had to be specific about using a function. So, in short form, this is what I did and, it works. Created a new code module then, delcared a public variable, set the variable in each calling form to be the name of the calling form then, used variable in the called form to return (stDocName = variable name).

    Thanks again.

Posting Permissions

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