Access Choosing Printer VBA Access

Joined
Dec 16, 2012
Messages
1
Reaction score
0
Hi,

I got a form with a print button., I made code for the button in VBA. The preview mode works perfect and when i print it with OpenReport to the default it works perfect also.
Now i am trying to get the printer menu on screen so the user can choose the printer where he wants to print on.
I got this done with DoCmd.RunCommand acCmdPrint but now it prints all records from the database:-(
No idea where i can find a solution for this. Who can help me....


My code is:
Code:
Private Sub Print_Lijstje_Click()

Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "rptLijstje"
stLinkCriteria = "[RecordId]=" & Me![RecordId]
On Error GoTo Err_Handler:

DoCmd.OpenReport stDocName, acViewPreview, , stLinkCriteria, acDialog
DoCmd.RunCommand acCmdPrint
DoCmd.Close acReport, stDocName, acSaveNo

DoCmd.Hourglass (True)
Exit_Point:
DoCmd.Hourglass (False)
Exit Sub
Err_Handler:
DoCmd.Close acReport, stDocName, 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
 
Back
Top