Results 1 to 11 of 11
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    MSKB sample won't work for me (XP (but A2K format)

    This morning I was studying a <!post=HansV's post, 357528>HansV's post<!/post> that discusses the use of Automation to make a Word document with Access as the automation client. Hans recommended WendellB's Automation 101 tutorial, which in turn recommended MSKB article 210090, "Acc2000: How to Use Visual Basic for Applications to Minimize, Maximize, and Restore Access." The article offers up some sample VBA code and steps me through the creation of a small form with a command button that, when clicked, minimizes Access.

    I did not just copy and paste the code

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: MSKB sample won't work for me (XP (but A2K format)

    Is there some reason to use the % character in declaring your variables? That drives me crazy, since it is much harder to read than declaring a variable as a Long, or whatever. Most of us no longer use that approach and I can never remember the meaning of the variable characters without looking them up.

    The reason you're getting an error is that the constant you use in the code is not identical to the constant you declare at the module level. You slipped in an extra H in the declaration.
    Charlotte

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Re: MSKB sample won't work for me (XP (but A2K for

    Why the % character? Beats me, Charlotte, but that's precisely how Kaiser Bill's knights wrote the sample code. I know virtually nothing about this code stuff

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

    Re: MSKB sample won't work for me (XP (but A2K for

    The code you posted is for minimizing/maximizing/restoring the Access application window. Doing the same for a form or report is much simpler, you can use DoCmd.Minimize, DoCmd.Maximize and DoCmd.Restore for that, no esoteric Windows API code needed. But why not maximize the report instead of minimizing the form?

  5. #5
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Re: MSKB sample won't work for me (XP (but A2K for

    Hello, Hans: Well, that does make sense (maximizing the report).

    Thanks!

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

    Re: MSKB sample won't work for me (XP (but A2K for

    You could put code in the On Activate and On Deactivate events of the report:

    Private Sub Report_Activate()
    DoCmd.Maximize
    End Sub

    Private Sub Report_Deactivate()
    DoCmd.Restore
    End Sub

  7. #7
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Re: MSKB sample won't work for me (XP (but A2K for

    Thanks, Hans! One particular report that we use always opens in Normal (restored) view/size. The zoom property always sits at "Fit." How can I set in code the zoom value?

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

    Re: MSKB sample won't work for me (XP (but A2K for

    You must do that from the code used to open the report, not from an event of the report itself.

    DoCmd.OpenReport "rptSomething", acViewPreview
    RunCommand acCmdZoom100

    Available arguments for zoom range from acCmdZoom10 to acCmdZoom1000. See the Object Browser (F2).

  9. #9
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: MSKB sample won't work for me (XP (but A2K for

    Long is a long integer, which holds larger whole numbers than an integer. Characters like % are type identifier characters in many languages and there is still support for them in VB/VBA, but unless you use them, you tend to forget what they mean. I've always resisted them because I just can't remember what they mean.

    <table border=1><td>Character</td><td>DataType</td><td>%</td><td>Integer</td><td>&</td><td>Long</td><td>!</td><td>Single</td><td>#</td><td>Double</td><td>$</td><td>String</td><td>@</td><td>Decimal</td></table>
    Charlotte

  10. #10
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Re: MSKB sample won't work for me (XP (but A2K for

    Great information, Hans! Thank you!

  11. #11
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Re: MSKB sample won't work for me (XP (but A2K for

    Thanks for taking the time to post that information!

Posting Permissions

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