Hi,
I have a hyperlink on a form to open a report. The below code is what I entered in the OnClick event on the form. I also have the default view for the report set to Print Preview, yet the report opens in Report View. Please help.
I have a hyperlink on a form to open a report. The below code is what I entered in the OnClick event on the form. I also have the default view for the report set to Print Preview, yet the report opens in Report View. Please help.
Code:
Private Sub prntRevHistory_Click()
Dim strWhere As String
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[ProjectID] = """ & Me.[ProjectID] & """"
strWhere = "[DwgNo] = """ & Me.[DwgNo] & """"
DoCmd.OpenReport "rptRevHistory", acViewPreview, , strWhere
End If
End Sub