Print preview first, instead of printing...

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
 
F

fredg

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top