Results 1 to 4 of 4
  1. #1
    Lounger
    Join Date
    Mar 2003
    Location
    Gainesville, Florida, USA
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Modal or Popup (Access XP)

    I have a main form that calls a popup form. The popup form sets a global variable based on list item selection. Once the popup is closed I want the main form to display the value of the global variable. This works fine if the popup form is NOT set to popup or modal. I have the main form onfocus event get and display the value of the global variable. Apparently the "on focus" or "activate" event doesn't get triggered if the main form calls a popup or modal form. Any ideas?

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Modal or Popup (Access XP)

    From the mainform, open the popup form like this:
    DoCmd.Openform "popupformname",windowmode:=acDialog
    txtglobalvariable = globalvariable

    Open the popform with acDialog freezes execution of code in the mainform. The next line of code (putting the global variable in a control on the mainform) will occur only after the popup form has closed.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Modal or Popup (Access XP)

    If you close a form with PopUp = Yes or a form that has been opened using DoCmd.OpenForm with acDialog, no OnActivate or OnFocus event is triggered on the form that becomes active, but both events will be triggered when the other form has Modal = Yes and Popup = No.

    You can use the OnClose or OnUnload event of a popup form to set the value of a control on the main form when the popup form is closed.

  4. #4
    Lounger
    Join Date
    Mar 2003
    Location
    Gainesville, Florida, USA
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Modal or Popup (Access XP)

    Thanks! that worked.

Posting Permissions

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