Depends on how your search works on the form. If your search box applies a filter to the records in your form via the control's after_update event, you can place a report button on the form which will open the report and apply the same filter to the report when it is opened, hence showing the same records. It takes very little programming of the on-click event of the report button.
Here is an example of a similar technique, used in this case to pick specific departments on which to report. This is from a selection form which uses two combo boxes, first_dept and last_dept, to select from a list of ordered departments. The default for the combos is "*" for show all, and as you will see from the code if this is the combo value the report is opened without a filter.
If the user selects specific departments the report is opened with a filter condition to show only the reports from the first to the last departments specified.
- Private Sub Report_Click()
Dim stDocName As String
-
stDocName = "ACT001" ' change this to the name of your report
-
'
-
' change the control name to the name of the search control in your
-
' form, and apply whatever filter is appropriate for your circumstances
-
'
-
If Me.First_Dept = "*" Then
DoCmd.OpenReport stDocName, acPreview
ElseDoCmd.OpenReport stDocName, acPreview, , "[Sequence No] between " & Me.First_Dept.Column(4) & " AND " & Me.Last_Dept.Column(4)
End IfEnd Sub
Cheers
Stewart