Printing report problem

apsuhos

New member
Local time
Yesterday, 23:15
Joined
Sep 11, 2009
Messages
1
Hey there..

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
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?
 
Try stepping through your code in debug mode to see what it is doing.
 

Users who are viewing this thread

Back
Top Bottom