Print preview first, instead of printing...

  • Thread starter Thread starter AndreasO
  • Start date Start date
A

AndreasO

I like to preview this report first, what do I need to change:

Private Sub Command42_Click()
On Error GoTo Err_Command42_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Main Info Source Report"

stLinkCriteria = "[Project ID]=" & Me![Project ID]
DoCmd.OpenReport stDocName, , , stLinkCriteria

Exit_Command42_Click:
Exit Sub

Err_Command42_Click:
MsgBox Err.Description
Resume Exit_Command42_Click

End Sub

Thanks for your help

Andreas
 
I like to preview this report first, what do I need to change:

Private Sub Command42_Click()
On Error GoTo Err_Command42_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Main Info Source Report"

stLinkCriteria = "[Project ID]=" & Me![Project ID]
DoCmd.OpenReport stDocName, , , stLinkCriteria

Exit_Command42_Click:
Exit Sub

Err_Command42_Click:
MsgBox Err.Description
Resume Exit_Command42_Click

End Sub

Thanks for your help

Andreas

Notice those commas in your code? They're there for a purpose.
Read VBA help on the OpenReport method.

DoCmd.OpenReport stDocName, acViewPreview, , stLinkCriteria
 
Back
Top