Results 1 to 10 of 10
  1. #1
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    839

    VBA Opening report not minimized

    I am using this code to open the form:

    Code:
    Private Sub Form_Load()
    DoCmd.ShowAllRecords
    DoCmd.GoToRecord , "FrmInputData", acNewRec
    DoCmd.RunCommand acCmdAppMinimize
    End Sub
    It minimizes the application and set the form for a new record. This code is fine.


    Now I have a command button to open a report:

    Code:
    Private Sub OpenrptRollup_Click()
        DoCmd.Close , ""
        DoCmd.OpenReport "rptRollup", acViewReport, "", "", acNormal
    End Sub
    This in essence works fine it closes the form and opens the report. But it opens the report minimized.

    I have tried Report_Activate, Report_Load, Report_Current to get it to automatically resize itself for viewing. the report is set for pop up, center and resize. So far a no go.

    Code:
    Private Sub Report_Load()
        DoCmd.MoveSize , , 20000, 20000
    End Sub
    I think it has something to do with the "DoCmd.RunCommand acCmdAppMinimize" as the report will open fine when I have Access Maximized.

    Suggestions?

    Thanks

    T

  2. #2
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,405
    In the form's close_event, add
    Code:
    docmd.restore

  3. #3
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    839
    davgri,

    No affect with:
    Code:
    Private Sub OpenrptRollup_Click()
        DoCmd.Restore
        DoCmd.Close , ""
        DoCmd.OpenReport "rptRollup", acViewReport, "", "", acNormal
    End Sub
    Attached is the dBPersonnel.zip

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Move

    DoCmd.Restore

    down to after you open the Report.
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    839
    Code:
    Private Sub OpenrptRollup_Click()
        DoCmd.Close , ""
        DoCmd.OpenReport "rptRollup", acViewReport, "", "", acNormal
        DoCmd.Restore
    End Sub
    Doesn't work.

    The form will open correctly from the command button in the report.

  6. #6
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,405
    ThompytPersonnel.zip
    Does this do what you want?

  7. #7
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    839
    Davegri,
    Unfortunately no. That gives you the print preview. It does give me some ideas I want to try. Nope - No go

    This is what I want to get to:
    Click image for larger version. 

Name:	DesiredJ.jpg 
Views:	11 
Size:	126.1 KB 
ID:	31587


    This is what I get:

    Click image for larger version. 

Name:	NotDesired.jpg 
Views:	11 
Size:	113.4 KB 
ID:	31588

  8. #8
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,405
    davegri_ThompytPersonnel-v02.zip
    Try this approach. It uses the docmd.movesize to display the report in any size and position you want.
    Bye the way, if you didn't already know, in the display in post #7 above, you can drag down the title bar to show the whole report.
    Last edited by davegri; 12-11-2017 at 11:14 AM. Reason: clarification

  9. #9
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    839
    Thanks davgri,
    Yes I knew that you could expand it, but didn't want to have to do that.

    I think my screw up was that I didn't fill it out completely: DoCmd.MoveSize 5000, 2000, 14000, 12000 was DoCmd.MoveSize ,, 14000, 12000

  10. #10
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,405
    Nice little coding puzzle - I hope the solution works out, and good luck with the rest of your project.

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

Similar Threads

  1. Running Access in Minimized mode
    By Forbes in forum Reports
    Replies: 4
    Last Post: 09-14-2018, 12:39 PM
  2. Minimized window in error
    By kconsroe in forum Access
    Replies: 1
    Last Post: 11-04-2013, 08:49 AM
  3. Replies: 3
    Last Post: 01-16-2013, 02:53 PM
  4. Window Access Minimized/Maximized Problem
    By PATRICK in forum Programming
    Replies: 2
    Last Post: 09-18-2012, 06:25 AM
  5. Excel automation (open minimized)
    By jfgrenier in forum Programming
    Replies: 2
    Last Post: 11-06-2011, 05:53 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