Welcome to SO in Spanish. What happens to you right now is very common in programming. You have N references, where N is an indeterminate number, and you would need N variables. Sometimes 2, other times, 8, other times 10 ... etc.
To do this, you need to use matrices , also called arrays, arrays . To simplify the explanation a lot, I will tell you that matrices is a variable that allows you to save a set N of values. But I strongly recommend that you read the following link in Spanish if you want to delve into matrices ( highly recommended ):
Matrices in Visual Basic
Well, knowing this, you say you have a Recordset that returns an N number of records (between 1 and 10). I suppose that in that Recordset you will have an ID field. The steps to follow would be:
Create the matrix
Resize the matrix according to the number of records returned from the Recordset
Put all the IDs in the matrix
Open report
I do not know where your data is, so you'll have to adapt it. Let's suppose that you have a form that returns the Recordset according to what interests you, and from there you click on a button to take that data to a report. Then:
Dim RST As Recordset
Set RST = Me.Form.RecordSet.Clone
RST.MoveLast
RST.MoveFirst
Dim MiMatriz() As Long
ReDim MiMatriz(RST.RecordCount)
Dim ZZ As Long
ZZ = 0
Do Until RST.EOF = True
MiMatriz(ZZ) = RST.Fields("Id").Value
ZZ = ZZ + 1
RST.MoveNext
Loop
Set RST = Nothing
Dim EstosInformes As String
For ZZ = 0 To UBound(MiMatriz) Step 1
EstosInformes = EstosInformes & MiMatriz(ZZ) & ", "
Next ZZ
EstosInformes = Left(EstosInformes, Len(EstosInformes) - 2) 'para quitar el último ", "
Erase MiMatriz
DoCmd.OpenReport "ordentallerSobre", acViewPreview, , "[ID] IN (" & EstosInformes & ")"
I hope you can adapt this code to your needs. And really, I strongly recommend you master matrices, because they are very useful.