Results 1 to 5 of 5
  1. #1
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Printing from Code (A2K SR1)

    I need to open a report and print the entire report from code from a command button (Which, BTW is printing out a number of other items as well.)

    The below code opens the report and then gets the report ready to print.

    DoCmd.OpenReport stDocName, acPreview
    DoCmd.RunCommand acCmdPrint

    Here's the problem. I have to press the OK button to get the report to print. (I don't want to press any more buttons.... <img src=/S/bwaaah.gif border=0 alt=bwaaah width=123 height=15>

    Is there an easy way use a command button to launch a report and then send the report to the printer without requiring any input from the user? I can't seem to figure it out.
    Regards,

    Gary
    (It's been a while!)

  2. #2
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Printing from Code (A2K SR1)

    I seem to have misplaced by brain this morning. The correct answer is:

    stDocName = "PRM06 - PROGRAM VITAL STATISTICS BY CLIN SLIN"
    DoCmd.OpenReport stDocName, acPreview
    DoCmd.PrintOut acPrintAll
    Regards,

    Gary
    (It's been a while!)

  3. #3
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Printing from Code (A2K SR1)

    Even simpler :
    stDocName = "PRM06 - PROGRAM VITAL STATISTICS BY CLIN SLIN"
    DoCmd.OpenReport stDocName, acViewNormal
    Francois

  4. #4
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Printing from Code (A2K SR1)

    Gary,

    Why not just use

    DoCmd.OpenReport stDocName, acViewNormal

    That will print it without previewing it
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

  5. #5
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Printing from Code (A2K SR1)

    ... as I said, No brains this morning. Thanks.
    Regards,

    Gary
    (It's been a while!)

Posting Permissions

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