Results 1 to 10 of 10
  1. #1
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Printing Reports (2003)

    I have a database which creates/prints CofC's. I have a button on the form which sends the CofC straight to the printer. At the same time, a pdf is opened for printing, which is associated with the CofC. My first question is, how can I get the Access report to print 2 copies? Secondly, is there a way of getting the pdf document to print straight to printer, and not open the pdf reader? I am assuming there isn't, as it's independent of Access, but I thought I'd ask anyway.

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

    Re: Printing Reports (2003)

    DoCmd.OpenReport with acViewNormal will print a single copy. You could call DoCmd.OpenReport twice, or you could call it with acViewPreview to open the report in preview mode, then use DoCmd.PrintOut with Copies:=2 to print 2 copies.

    Are you generating the PDF or just opening an existing PDF?

  3. #3
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Printing Reports (2003)

    Just opening an existing pdf.

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

    Re: Printing Reports (2003)

    See <post:=716,067>post 716,067</post:> for code that you can use to print a pdf file.

  5. #5
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Printing Reports (2003)

    Because the report name is made up of the customer order number and the part number, I had the following code on the button to open the pdf :-
    If Me.Stock_Code_No_1 Like "1M*" Then
    Const strPath = "U:Common FoldersQuality Department SharedDrawings"
    Dim strFile As String
    strFile = Dir(strPath & "*" & Trim(Me.Stock_Code_No_1) & " - " & Trim(Me.Customer_Order_No_1) & ".pdf")


    If strFile = "" Then
    ' File not found, display warning
    MsgBox "No report found for this Drawing No.", vbExclamation
    Else
    ' File found, open it in default PDF reader
    Application.FollowHyperlink strPath & strFile

    End If
    Else: End If

    I created a module as in your post, and replaced Application FollowHyperlink with Call PrintFile(strFile). Should this work, as it doesn't. I suspect there's something wrong with strFile.

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

    Re: Printing Reports (2003)

    Try

    Call PrintFile(strPath & strFile)

  7. #7
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Printing Reports (2003)

    I did try that to start with, and got the message "Something went wrong". I created a standard module as stated, and it's called Module2.

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

    Re: Printing Reports (2003)

    It's impossible for me to tell what causes the problem without seeing the database and pdf file.

  9. #9
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Printing Reports (2003)

    I've sorted it by changing the If IngResult=<= 32, to 15. Although I don't exactly know what it does, it works.

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

    Re: Printing Reports (2003)

    Strange... <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>

Posting Permissions

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