Connecting Tech Pros Worldwide Help | Site Map

Windows Print Dialog box. acCmdPrint. Single Record.

  #1  
Old November 15th, 2008, 08:55 PM
Greg (codepug@gmail.com)
Guest
 
Posts: n/a
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
  #2  
Old November 15th, 2008, 11:15 PM
Tom van Stiphout
Guest
 
Posts: n/a

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.OpenReport "someReport",,,"CustomerID=5"

-Tom.
Microsoft Access MVP

Quote:
>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
  #3  
Old November 15th, 2008, 11:15 PM
Greg (codepug@gmail.com)
Guest
 
Posts: n/a

re: Windows Print Dialog box. acCmdPrint. Single Record.


The following code seems to work:


Private Sub cmdPRINTRec_Click()
'************************************************* ***
' PRINT Displayed Record. PRINT Record Button.
On Error GoTo Err_Handler:
DoCmd.OpenReport "REPORTNAME", acViewPreview, , "SICKID = " &
Me.SICKID
DoCmd.RunCommand 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
Closed Thread