Hi everybody,
hope you guys can help me.
I am a total newbe with VBA so please be good to me
My issue is:
I have a db where I ve stored all the prices for my customers in one single table
I create the rate sheet for every single customer pulling the data with a query into a report.
The query parameters are basically customer name and expiration date.
When i pull the report for one single customer I use a form to input these 2.
Every time I had to create all of the ratesheet for each customer (so far around 100 different ratesheets at the end of each month) it was a nightmare; so with extreme difficulties i managed to create the following that should create all the reports at once
It kind of works but it does not create all of the ratesheet and I get at a certain point a "run-time error '2501' the outputto action was canceled"
in the end out of 100 report i get 81 (it's always 81 it seems) wich is way better than nothing but still...
Can you help me?
hope you guys can help me.
I am a total newbe with VBA so please be good to me

My issue is:
I have a db where I ve stored all the prices for my customers in one single table
I create the rate sheet for every single customer pulling the data with a query into a report.
The query parameters are basically customer name and expiration date.
When i pull the report for one single customer I use a form to input these 2.
Every time I had to create all of the ratesheet for each customer (so far around 100 different ratesheets at the end of each month) it was a nightmare; so with extreme difficulties i managed to create the following that should create all the reports at once
Code:
Private Sub Comando0_Click()
Dim cnn1 As ADODB.Connection
Set cnn1 = CurrentProject.Connection
Dim rs As New ADODB.Recordset
rs.activeconnection = cnn1
rs.Open "[soloragsoc]"
Dim ragsoc As String
Dim file As String
Dim path As String
Dim db As Database
Dim ingragsoc As String
Dim repName As String
repName = "new report"
If Not rs.EOF Then
rs.MoveFirst
Do While Not rs.EOF
ingragsoc = rs.Fields(0)
path = "C:\Users\diego\Desktop\EXEPE"
file = "\Listino export Maggio 2016" & " " & ingragsoc & ".pdf"
Dim fulpafi As String
fulpafi = path & file
DoCmd.OpenReport repName, acViewPreview, , "[Q_Retrieve nolo export]![ragione sociale] ='" & ingragsoc & "'", , acFormatPDF, fulpafi
DoCmd.Close acReport, repName
rs.MoveNext
Loop
End If
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
It kind of works but it does not create all of the ratesheet and I get at a certain point a "run-time error '2501' the outputto action was canceled"
in the end out of 100 report i get 81 (it's always 81 it seems) wich is way better than nothing but still...
Can you help me?