Results 1 to 4 of 4
  1. #1
    VicM is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2017
    Location
    US-PA & FL
    Posts
    52

    DoCmd.RunCommand acCmdZoom100:runtime error 2046-command or action isn't available now.

    Hi,
    I'm using Access 2010 on a 64 bit Win7 Premium box.

    I have a very simple report which is triggered from a form button. There are only a few lines in the report and only one text box that displays the results. The report opens in preview mode. But I want to expand it on the screen as much as possible. Normally when opening a report in preview mode I believe it opens as 'fit to window' or a rather small window. I can maximize the window. But once done, if you click in the window, the size of the report increases again and is much more readable. That's what I'd like to achieve thru vba.

    Here is the Report_Open code:

    Code:
    Private Sub Report_Open(Cancel As Integer)
        Public Const TWIPSPERINCH = 1440 'This line is actually in a module declaration.  I put it here to clarify the code.
        DoCmd.MoveSize 1 * TWIPSPERINCH, 0.5 * TWIPSPERINCH, 8 * TWIPSPERINCH, 5 * TWIPSPERINCH
        DoCmd.RunCommand acCmdZoom100
    End Sub
    When the Report_Open code gets to the last line it throws the runtime error 2046; command or action 'Zoom 100%' isn't available now.

    I've tried a couple of different Zoom amounts all with a similar error. I've also tried replacing the DoCmd.MoveSize line with just DoCmd.Maximize. Again with the same result on the acZoom line.

    Any thoughts?



    Happy holidays,
    Vic

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,818
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    VicM is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2017
    Location
    US-PA & FL
    Posts
    52
    Thanks June7.

    But I was unable to get anything from that post, after trying some of its suggestions, other than there might be a missing Reference.
    So I decided that I was going to display the results in a listbox of a form instead. This will actually give me the opportunity to code for the possibility to make changes if need be.

    Thanks,
    Vic

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,818
    The point is, code would not be behind report but in form code that opens report. That works. Is that what you tried?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 12
    Last Post: 05-18-2017, 10:15 AM
  2. Replies: 11
    Last Post: 11-30-2015, 01:06 PM
  3. Replies: 3
    Last Post: 01-02-2015, 02:06 PM
  4. Replies: 3
    Last Post: 06-09-2012, 08:14 AM
  5. Replies: 5
    Last Post: 03-30-2010, 12:53 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