report printing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Saloc
    New Member
    • Jul 2006
    • 23

    #1

    report printing

    :) hi all Im strugling with the code to a print button I need it to print the last report it has created only

    I am inputing data into a data base in form view and need to print a report of that data every time I type in the data they are in a Justified view as thats how I need the data

    the code I got is

    stDocName = "report"
    DoCmd.OpenRepor t stDocName, acNormal
    DoCmd.OpenRepor t "report", acViewPreview
    DoCmd.SelectObj ect acReport, "report", False
    DoCmd.PrintOut [acPrintRange = acPages], [PageFrom 1], [PageTo 1], [AcPrintQuality = acHigh]


    its doing my head in please help :eek: thanks

    Saloc
  • comteck
    New Member
    • Jun 2006
    • 179

    #2
    Is this code part of a button, textbox, etc? What event procedure is being used (OnClick, OnCurrent, etc.). And, what error messages are you getting?

    comteck

    Comment

    • Saloc
      New Member
      • Jul 2006
      • 23

      #3
      Originally posted by comteck
      Is this code part of a button, textbox, etc? What event procedure is being used (OnClick, OnCurrent, etc.). And, what error messages are you getting?

      comteck

      on click on current oh my now I really do have a headache

      but I get no errors it just prints all reports out :mad: :confused:

      I will check out and try to get more details

      Comment

      • Saloc
        New Member
        • Jul 2006
        • 23

        #4
        This is a copy and paste of what I got can you help PLEASE :confused: :confused: :eek: :o


        Private Sub Command22_Click ()
        On Error GoTo Err_Command22_C lick


        DoCmd.close

        Exit_Command22_ Click:
        Exit Sub

        Err_Command22_C lick:
        MsgBox Err.Description
        Resume Exit_Command22_ Click

        End Sub
        Private Sub Command26_Click ()
        On Error GoTo Err_Command26_C lick


        DoCmd.close

        Exit_Command26_ Click:
        Exit Sub

        Err_Command26_C lick:
        MsgBox Err.Description
        Resume Exit_Command26_ Click

        End Sub
        Private Sub Command27_Click ()
        On Error GoTo Err_Command27_C lick

        Dim stDocName As String

        stDocName = "report"
        DoCmd.OpenRepor t stDocName, acNormal
        DoCmd.OpenRepor t "report", acViewPreview
        DoCmd.SelectObj ect acReport, "report", False
        DoCmd.PrintOut [acPrintRange = acPages], 1, 1, , 1


        Exit_Command27_ Click:
        Exit Sub

        Err_Command27_C lick:
        MsgBox Err.Description
        Resume Exit_Command27_ Click

        End Sub


        Private Sub Command27_DblCl ick(Cancel As Integer)

        End Sub

        Comment

        Working...