Hello All,
I have a main form with an unbound subform. There are two date boxes on the main form that when entered will run a query and update the subform with any records within that date range. Then there is a command button than when clicked will run another query on the results already in the subform and display any duplicate records. I have added another command button and would like to be able to print whatever records are displayed (original records, or records from the first query, or records from the last query) in the subform to an existing report. I have tried the code below. It opens the report but with all of the records. I used the code below to export whatever records are in the subform to Excel and it works fine. Any help would be greatly appreciated with the code below or a better method to print whatever records are currently displayed in the subform.
Code:
Me.frmDuplicatesSfrm.SetFocus
[frmDuplicatesSfrm].Form![PerformID].ColumnHidden = False
DoCmd.GoToControl "PerformID"
DoCmd.RunCommand acCmdSelectAllRecords
DoCmd.RunCommand acCmdCopy
DoCmd.OpenReport "rptPerformData", acViewPreview, , , acWindowNormal
I have also posted this question at the below link since I am not receiving any replies here.
http://www.dbforums.com/showthread.p...71#post6650271