Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2003

    Unanswered: How to pass a variable to a pop-up form

    I want to pass a row ID to a pop-up form and then have the pop-up form populate its controls based on that row ID. I've tried setting a control's value from the original form like Forms!PopUp!Control="XYZ", but I can't get any of the pop-up form's events to run the query and fill in the rest of the controls.

  2. #2
    Join Date
    Sep 2006
    Surrey, UK
    Provided Answers: 2
    I normally do this by declaring a global variable first. Then, in the sub that calls the pop-up form, I add a line to populate the global variable with the required value.

    On the pop-up form's Load event, you can then either set a control to hold the value from the global variable, or simply refer to the variable in a series of DLookup statements (or however you get the data into the pop-up).

  3. #3
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    if the popupform is called from a single prorgram
    pull the value from the calling form

    in the calling form
    myvariable = forms!mycourceform!mycontrolname
    myvariable = forms!mycourceform!myvariablename

    global variables can be a godsend when you need to use.. but there is no need to use them for this...... they are all to easy to forget which form is using them at any onetime.
    I'd rather be riding on the Tiger 800 or the Norton

  4. #4
    Join Date
    Jul 2006
    i think essentially what he is trying to do is simple;

    docmd.openform "popupformname",,"Id = " & [ID]

    should open a form, and filter it to the id of the current record.
    Posted as-is.
    Any spelling and/or grammar mistakes are a direct
    result of a communication glitch between my brain
    and my fingers which may or may not be
    directly related to a lack of caffeine intake.

  5. #5
    Join Date
    Nov 2007
    Adelaide, South Australia
    ▲ Agreed with that.
    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

Posting Permissions

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