Results 1 to 8 of 8
  1. #1
    Join Date
    Jul 2002
    Location
    Island of Dots
    Posts
    316

    Unanswered: Problem with acHidden

    I have a report with image controls in it. The image controls .Picture property is set in VBA on the reports On Activate event. When I print this report with the following code, the images are not printed:

    Code:
    DoCmd.OpenReport "rptQ", acViewNormal, "", "", acHidden
    To get around this, I tried opening the report in preview mode, then printing:

    DoCmd.OpenReport "rptQ", acViewPreview, "", "", acHidden
    DoCmd.OpenReport "rptQ", acViewNormal, "", "", acHidden
    DoCmd.Close acReport, "rptQ"
    This works, with the images being printed. However, despite using acHidden, the report quickly flashes-up on screen before being printed. It looks very messy and unprofessional. Is there a way I can get round this?

    I also have the same problem when I try to create a snapshot file.

  2. #2
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Not sure if this would work but could you open the report and quickly set it to invisible (it may not work though):

    Docmd.openreport "rptQ",acviewnormal
    Reports!rptQ.visible = false
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    Jul 2002
    Location
    Island of Dots
    Posts
    316
    I'd like to try that, but I'm having problems using the Reports collection because my report name is concatenated. This what I'm using:

    Code:
    DoCmd.OpenReport "rptQ" & intItems, acViewNormal
    Reports!rptName & intItems.Visible = False
    However, the 2nd line doesn't work. I've tried a few variations, but I can't get the concatenated reference to work. Can anyone help?

  4. #4
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    441
    When referring to an item in the reports collection with a dynamic name, try for instance

    Reports("rptQ" & intItems).Visible = False

    or

    Dim strReport as String
    strReport = "rptQ" & intItems
    DoCmd.OpenReport strReport, acViewNormal
    Reports(strReport).Visible = False
    Roy-Vidar

  5. #5
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Reports aren't my longsuit, by any stretch of the imagination, but something that did strike me as odd was the fact many of your attempts above show OpenReport with 5 parameters (the last being acHidden) whereas, per Access Help, OpenReport only takes 4 parameters. acHidden as the last parameter is only valid, I believe, when used with OpenForm. Am I missing something here? An undocumented feature, maybe?

    DoCmd.OpenReport reportname[, view][, filtername][, wherecondition]
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  6. #6
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    441
    Starting with the 2002/xp version, I think, the openreport method of the docmd object also got WindowMode and OpenArgs arguements (as forms have).
    Roy-Vidar

  7. #7
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    I see! Another question, Roy-Vidar. I'm not used to seeing a zero-length strings used instead of simply spaces for unused parameters. Could this be causing Access to "stutter" as it evaluates them?
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  8. #8
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    441
    I don't know, as I've never tried

    I think I've seen someone writing something along the lines of what you suggest, recommending not to pass anything unless one has something to pass, but I'm not able to find/verify this at the moment.
    Roy-Vidar

Posting Permissions

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