Results 1 to 7 of 7
  1. #1
    jcc285 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Aug 2014
    Posts
    70

    Minimizing Access Window on form restore from the taskbar

    I have a database running in minimized mode i.e. from the desktop shortcut link, the Access Window is minimized to the task bar and my opening form 'floats' on the desktop.



    I have several options in the database application where I minimize the displayed Access form to the taskbar e.g. Create an Excel Table or Run a Word Mail Merge.

    The user can happily work away in Excel or Word with the Access icon sitting in the task bar, ultimately closing Excel or Word.

    When the user then double clicks the Access icon I want the minimized Access form to be restored floating on the desktop i.e. as we began, however, when the user takes that action the Access Window always opens behind the form, sometimes with peculiar positioning e.g. half the screen.

    Does anyone know how to achieve what I would like please ?

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Yes. Have a look at the latest version of my example app showing ways of controlling the application interface.
    http://www.mendipdatasystems.co.uk/c...ace/4594365418
    This includes code that fixes the issue you describe when clicking on the taskbar icon
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    jcc285 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Aug 2014
    Posts
    70
    Thank you, I had found that code elsewhere. My problem is I don't really know how to use it !!

    I have easily minimize the displayed Access Form -
    'Minimise the Main Menu
    DoCmd.SelectObject acForm, "frm_Main_Menu"
    DoCmd.Minimize

    Assuming I have copied your module into my application, which 'Event' of the 'frm_Main_Menu' does your code 'SetAccessWindow (SW_SHOWMINIMIZED)' need to be in when I restore the frm_Main_Menu by clicking on it in the taskbar please ?
    I've tried, Load, Open and Resize. I guess i'm looking for an 'On Restore' event which doesn't exist !!

    Maybe, what I need is to check the Access Window state and minimize it if it is maximized but, again, I don't know the event order when I restore the form from the taskbar.

    Sorry if this is a 'thick' question but I just don't seem to be able to make this work.

    Thanks again for your help.

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Look carefully at the Form_Load event of the form frmStart. It includes these 3 lines
    Code:
        SetWindowLong Me.hWnd, GWL_EXSTYLE, GetWindowLong(Me.hWnd, GWL_EXSTYLE) Or WS_EX_APPWINDOW
        ShowWindow Application.hWndAccessApp, SW_HIDE
        ShowWindow Me.hWnd, SW_SHOW
    Why have you minimised your form? If you want to restore it use DoCmd.Restore or DoCmd.Maximize as appropriate

    I only use SetAccessWindow SHOW_MINIMIZED in very limited circumstances though you can find examples of its use elsewhere in the form code
    Whether you need it will depend on what you did to your form before clicking on the taskbar icon.

    I realise that doesn't answer your question, but unless I know more about your setup I can't give a definitive answer.
    Suggest you look at each part of the code in my app.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  5. #5
    jcc285 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Aug 2014
    Posts
    70
    Quote Originally Posted by isladogs View Post
    Look carefully at the Form_Load event of the form frmStart. It includes these 3 lines
    Code:
        SetWindowLong Me.hWnd, GWL_EXSTYLE, GetWindowLong(Me.hWnd, GWL_EXSTYLE) Or WS_EX_APPWINDOW
        ShowWindow Application.hWndAccessApp, SW_HIDE
        ShowWindow Me.hWnd, SW_SHOW
    Why have you minimised your form? If you want to restore it use DoCmd.Restore or DoCmd.Maximize as appropriate

    I only use SetAccessWindow SHOW_MINIMIZED in very limited circumstances though you can find examples of its use elsewhere in the form code
    Whether you need it will depend on what you did to your form before clicking on the taskbar icon.

    I realise that doesn't answer your question, but unless I know more about your setup I can't give a definitive answer.
    Suggest you look at each part of the code in my app.


    I've attached some screen shots which demonstrate the problem. Access problem.pdf

    I am attempting to answer your question 'Why have you minimized your form' and give more information on what I am trying to achieve. I could easily believe that what I want is not possible !!

  6. #6
    jcc285 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Aug 2014
    Posts
    70
    SUCCESS!! Adding you code as the last post to the Form Load Event and the modDatabaseWindow to my Application produces the result I was looking for.

    Many thanks for your help.

  7. #7
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Glad to have helped. Good luck with the rest of your project
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

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

Similar Threads

  1. Replies: 17
    Last Post: 07-09-2021, 02:55 PM
  2. Replies: 5
    Last Post: 10-29-2017, 06:46 AM
  3. Replies: 5
    Last Post: 07-18-2014, 02:04 AM
  4. Replies: 1
    Last Post: 03-20-2013, 07:04 AM
  5. Replies: 2
    Last Post: 05-16-2012, 10:52 AM

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