Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Manassas, Virginia, USA
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Code to close a popup form (2002, SP3)

    I have a popup form that displays when the user selects a sport, a specific game, and a player from an unbound form screen and then clicks the command button to display or enter the stats for the player for that game. My question is how to I make the popup form close if the popup form looses focus? I tried the lost focus event for the popup form but that event does not fire when I click back on the unbound form. I tried using the on change event for the combo boxes where a user would select a different sport, game, or player but every place I try to put code to close the popup form it does not have any effect.
    Judy Jones, Computer Training Specialist
    Manassas, Virginia

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

    Re: Code to close a popup form (2002, SP3)

    Why not put a "Close" command button on the form?

  3. #3
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Manassas, Virginia, USA
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Code to close a popup form (2002, SP3)

    If the user would fail to click the close button and then they would change the player on the main form, the popup form was not requerying with the newly selected player's stats. I tried to make the popup form requery if I changed the name if a player but that did not work so to be on the safe side, I thought I would be better off to close the popup once the user clicks outside of the popup.
    Judy Jones, Computer Training Specialist
    Manassas, Virginia

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

    Re: Code to close a popup form (2002, SP3)

    If you set the Modal property of the form to Yes, the user cannot click outside it - the form *must* be closed. You get the same effect if you open the form with the WindowMode argument set to acDialog:
    <code>
    DoCmd.OpenForm FormName:="frmPlayer", WhereCondition:="...", WindowMode:=acDialog</code>

  5. #5
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Manassas, Virginia, USA
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Code to close a popup form (2002, SP3)

    Thanks. That did the trick.
    Judy Jones, Computer Training Specialist
    Manassas, Virginia

Posting Permissions

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