Originally Posted by
Robyn_P
I thought about SELECT TOP N but I wasn't sure how I would then use that when opening the report. How would you then go on to open the report?
First of all it would be "SELECT TOP " & N & " ....
I specifically said this approach was for action queries
I've not tested the following and it may well not work for TOP N or give an error
However I use something similar for other reports where the record source may vary e.g. based on crosstab query
a) Set the value of N in a textbox in the calling form e.g. N=5
Then set the record source for the report
Code:
strSQL = "SELECT TOP " & N & " ...."
DoCmd.OpenReport "MyReportName", avViewPreview
In your report, add this code
Code:
Private Sub Report_Open()
Me.RecordSource = strSQL
End Sub
By all means try it but don't be surprised if it errors