Results 1 to 5 of 5
  1. #1
    keviny04 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Apr 2015
    Posts
    128

    Alt-Tab makes popup form lose focus

    I know this kind of problem has been posted many times, but I just want to know if my specific situation calls for something different. I'm using Access 2007 SP3 on a Windows 7 Home Premium SP1 PC. My problem is that if my form is popup but not modal, then Alt-Tabbing out of Access and back in will make my form lose focus. Curiously, if I DON'T use Alt-Tab to switch to another application, i.e. if I mouse-click away to another application and mouse-click back to Access, then my popup form will STAY ON FOCUS. If the form is modal, then Alt-Tab won't make it lose focus (the way modal forms are supposed to be). But I can't use modal forms because I need more than one form open at a time. And of course, forms that are neither popup nor modal don't lose focus after Alt-Tabbing. But I need popup forms, because my forms are large and I need them to go beyond the boundaries of the Access application window. Anyone has any thoughts how to make popup-but-not-modal forms stay on focus after Alt-Tab?



    A side issue is that DoCmd.OpenForm can only open a form that is both popup and modal (when window mode is set to acDialog), but not either popup or modal. Is it possible to make it open a form that is popup but not modal, the kind of forms I need? Thanks in advance for any assistance.

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I would recommend setting the form's properties to pop up and leaving the VBA out of the equation. According to MS library acDialog is going to cause your form to be Modal and Pop Up. VBA will override most all of a Form's property settings.

    As for backing out of a Pop Up form with the tab key, I do not believe I have stumbled across that symptom before. Maybe use .SetFocus as a possible solution. Using VBA to set focus on a control within your Pop Up form may be a solution to the Tab key thing.

  3. #3
    keviny04 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Apr 2015
    Posts
    128
    Quote Originally Posted by ItsMe View Post
    As for backing out of a Pop Up form with the tab key, I do not believe I have stumbled across that symptom before.
    The problem is specifically this: if I Alt-tab away from my popup-but-not-modal form and Alt-tab back to Access, the focus will be on the navigation pane instead of the form. Even if I collapse the navigation pane, the focus will still go to it after Alt-Tab.

    Quote Originally Posted by ItsMe View Post
    Maybe use .SetFocus as a possible solution. Using VBA to set focus on a control within your Pop Up form may be a solution to the Tab key thing.
    I tried putting a Me.SetFocus method or Forms![formname].Form!ControlName.SetFocus in my form's LostFocus event. But when my form lost focus in any way, it remained lost.

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Well, I looked at a sample DB with a pop up form to try and understand the phenomenon. As soon as you employ the Alt key, you will lose focus of the form. I tried using different keyboard combos to bring focus back to the form but could not.

    If you are going to switch applications, you will need to use the mouse to focus on the Pop Up form. So if modal is out of the question, not sure what else you will be able to do.

    One other option might be to hide access to things like the navigation pane, Ribbon etc. However, I doubt this will make a difference since the Pop Up will have a different Window Handle, a Handle that is evidently invisible to the tab key.

  5. #5
    keviny04 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Apr 2015
    Posts
    128
    I'm thinking of a way (a button, an event, etc.) to programmatically toggle the Modal property of the form. Turn Modal on and the form won't lose focus after Alt-Tab. Turn it off so I can navigate to another form.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. A form that makes multiple entries
    By dimits in forum Forms
    Replies: 3
    Last Post: 06-09-2014, 12:53 PM
  2. What makes form 'design save' before open?
    By bhammer in forum Forms
    Replies: 2
    Last Post: 04-23-2012, 03:08 PM
  3. Replies: 1
    Last Post: 02-29-2012, 09:38 AM
  4. Verifing Data in a text box when it lose focus...
    By hswilliams2525 in forum Access
    Replies: 1
    Last Post: 01-17-2012, 08:36 PM
  5. Update Database on Lose Focus event
    By sgroth in forum Forms
    Replies: 2
    Last Post: 06-11-2011, 07:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums