Report on form in view

Keiath

Registered User.
Local time
Today, 21:12
Joined
Jan 6, 2012
Messages
104
Hi guys

I want to create a report, and have a button on the form to print a report base on the form. But I only want it to print a report based on the form in view

How do I do this, as at the moment when I print a report it prints all the reports

Thanks
 
Private Sub cmdReport_Click()
' Check that the current record has a stock code.
If IsNull(Me.[Stock Code]) Then
MsgBox "Please activate a record with a valid stock code.", vbExclamation
Exit Sub
End If
' Save the record if it has been modified
If Me.Dirty Then
Me.Dirty = False
End If
' Open the report
DoCmd.OpenReport ReportName:="rptStock", View:=acViewPreview, _
WhereCondition:="[Stock Code]=" & Chr(34) & Me.[Stock Code] & Chr(34)
End Sub

seems to have solved the problem

Thanks
 

Users who are viewing this thread

Back
Top Bottom