@Alex ha scritto:
Mafra8 ha scritto:
@Alex ha scritto:
Se conosci il VBA è fattibile, altrimenti no.
Diciamo di NI, tu hai qualche suggerimento da dare??
perchè non so proprio da dove inziare.
Nei LINK hai tutto... però devi in qualche modo adoperarti... altrimenti ti serve un consulente.
 Dim rs                    As DAO.Recordset
    Dim rpt                   As Access.Report
    Dim sFolder               As String
    Dim sFile                 As String
    Const sReportName = "Report1"   
    On Error GoTo Error_Handler
    sFolder = "C:\Users\Mafra8\Desktop\File prova access\"
    Set rs = CurrentDb.OpenRecordset("SELECT ID, Codice_Art FROM Articoli", dbOpenSnapshot)
    With rs
        If .RecordCount <> 0 Then    
            'Open the Report
            DoCmd.OpenReport sReportName, acViewPreview, , , acHidden
            'Define a report object so we can manipulate it below
            Set rpt = Reports(sReportName).Report
            Form.FilterOn = True
            .MoveFirst
            Do While Not .EOF
                'Build the PDF filename we are going to use to save the PDF with
                sFile = Nz(![ID], "") & " " & Nz(![Codice_Art], "") & " N" & ".pdf"
                sFile = sFolder & sFile
                
                rpt.Filter = "[ID]=" & ![ID]
                rpt.FilterOn = True
                DoEvents    
                DoCmd.OutputTo acOutputReport, sReportName, acFormatPDF, sFile, , , , acExportQualityPrint
                .MoveNext
            Loop
            DoCmd.Close acReport, sReportName
        End If
    End With
Error_Handler_Exit:
    On Error Resume Next
    If Not rpt Is Nothing Then Set rpt = Nothing
    If Not rs Is Nothing Then
        rs.Close
        Set rs = Nothing
    End If
    Exit Sub
Error_Handler:
    If Err.Number <> 2501 Then
        MsgBox "The following error has occured" & vbCrLf & vbCrLf & _
               "Error Number: " & Err.Number & vbCrLf & _
               "Error Source: cmd_GenPDFs_Click" & vbCrLf & _
               "Error Description: " & Err.Description & _
               Switch(Erl = 0, "", Erl <> 0, vbCrLf & "Line No: " & Erl) _
               , vbOKOnly + vbCritical, "An Error has Occured!"
    End If
    Resume Error_Handler_Exit 
Buongiorno, con questo codice riesco ad esportare un file pdf per record  vorrei però che quando vado a cliccare il pulsante e ho la maschera filtrata mi esportasse i pdf dei record filtrati e non tutti i record ? Qualcuno può aiutarmi ?