Just package it with Me.Name, like this:
Dim sForm, sName, sLink As String
sForm = Me.Name
Then something like:
sLink = "[FormName] = '" & sForm "'"
Then
sName = "rptMyHelpReport"
DoCmd.OpenReport sName, acPreview, , sLink
Check the syntax to make sure you have the sLink in the WHERE clause.
This should work, assuming your report is based on entries that are determined by the form name. You could also do this with button names.
HTH
mmcdonal
|