Filter a report, but need to then print it

red7

Registered User.
Local time
Today, 17:51
Joined
Feb 17, 2005
Messages
15
I have the following code for a command button to open a report showing the current record in the form the user is viewing:

Code:
Private Sub Command39_Click()
  'Filter report to display only Member currently showing on frmmembers
        ' (by MemberID field)
        DoCmd.OpenReport "rptgymattendance", acViewPreview, , "MemberID = " & MemberID
        
End Sub

However I need to change the code so that the command button will also print out that report, how would I go about doing this? (i.e. I open it, how do I print it?) I am a newbie and the 'PrintOut' function doesn't seem to work :confused:

Any help much appreciated :)

red.
 
If you remove the code acViewPreview.

the report will print.

To print and the view the report use

Private Sub Command39_Click()
'Filter report to display only Member currently showing on frmmembers
' (by MemberID field)
DoCmd.OpenReport "rptgymattendance", , , "MemberID = " & MemberID
DoCmd.OpenReport "rptgymattendance", acViewPreview, , "MemberID = " & MemberID

End Sub
 
Last edited:
Brilliant, thanks a million :)
 

Users who are viewing this thread

Back
Top Bottom