Hey there..
I wanted to create a print button that would print the report of the current form. I used allen browne's code
Even though it worked like it should, when I closed my DB and reopened it, the print button in the form didn't do anything. No error, no preview, not anything..
Any idea what the problem is?
I wanted to create a print button that would print the report of the current form. I used allen browne's code
Code:
Private Sub cmdPrint_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 = "[ID] = " & Me.[ID]
DoCmd.OpenReport "MyReport", acViewPreview, , strWhere
End If
End Sub
Any idea what the problem is?