Windows Print Dialog box. acCmdPrint. Single Record.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Greg (codepug@gmail.com)

    Windows Print Dialog box. acCmdPrint. Single Record.

    acCmdPrint allows me to print using the Windows Dialog. Since I want
    to be able to select the
    printer of my choice, this works well. I put his behind a button on a
    single form. The problem is, that instead of print the record that is
    being displayed, the entire table of data gets printed. How do I print
    just the single record being displayed, with the flexibility of
    Windows Dialog box that gives me the choice of printers?

    Thanks Greg
  • Tom van Stiphout

    #2
    Re: Windows Print Dialog box. acCmdPrint. Single Record.

    On Sat, 15 Nov 2008 12:46:55 -0800 (PST), "Greg (codepug@gmail. com)"
    <codepug@gmail. comwrote:

    In the Print dialog specify the page(s) you want to print.

    Or run the report with a Where-clause:
    docmd.OpenRepor t "someReport",,, "CustomerID =5"

    -Tom.
    Microsoft Access MVP

    >acCmdPrint allows me to print using the Windows Dialog. Since I want
    >to be able to select the
    >printer of my choice, this works well. I put his behind a button on a
    >single form. The problem is, that instead of print the record that is
    >being displayed, the entire table of data gets printed. How do I print
    >just the single record being displayed, with the flexibility of
    >Windows Dialog box that gives me the choice of printers?
    >
    >Thanks Greg

    Comment

    • Greg (codepug@gmail.com)

      #3
      Re: Windows Print Dialog box. acCmdPrint. Single Record.

      The following code seems to work:


      Private Sub cmdPRINTRec_Cli ck()
      '************** *************** *************** ********
      ' PRINT Displayed Record. PRINT Record Button.
      On Error GoTo Err_Handler:
      DoCmd.OpenRepor t "REPORTNAME ", acViewPreview, , "SICKID = " &
      Me.SICKID
      DoCmd.RunComman d acCmdPrint
      DoCmd.Close acReport, "REPORTNAME ", acSaveNo
      Me.Refresh
      DoCmd.Hourglass (True)
      Exit_Point:
      DoCmd.Hourglass (False)
      Exit Sub
      Err_Handler:
      DoCmd.Close acReport, "REPORTNAME ", acSaveNo
      DoCmd.Hourglass (False)
      Select Case Err
      Case 2212
      MsgBox "Cannot Print Now.":
      Resume Exit_Point
      Case 2501
      'MsgBox "Print Has Been Cancelled.":
      Resume Exit_Point
      Case Else
      Resume Exit_Point
      End Select
      End Sub

      Comment

      Working...