Results 1 to 5 of 5
  1. #1
    diegomarino is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    409

    Sub report not showing data on pdf export


    Hi, i have a Report that contains some sub reports in it

    when i see it in report view everything is ok, even in print preview, but when i export it using this function that i call clicking a button the sub report do not show the continuos form in it, there are no data

    print preview (ok):
    Click image for larger version. 

Name:	print prev.png 
Views:	18 
Size:	73.6 KB 
ID:	42903

    Pdf export:
    Click image for larger version. 

Name:	pdf.png 
Views:	18 
Size:	54.6 KB 
ID:	42904

    this is the function i use:
    Code:
    Function EsportaProfilo(ReportObject As Report, ReportName As String, FlName As String)    DoCmd.OutputTo acOutputReport, ReportName, acFormatPDF, FlName, True
    End Function
    this is the code started by the button click:
    Code:
    Private Sub EsportaBtn_Click()    Call EsportaProfilo(Screen.ActiveReport, Report.Name, "C:\Users\diego\OneDrive - Indipendente\Lavoro\HH\Candidati\" & Me.Regione & "\" & Me.NomeCognome & "\" & Me.NomeCognome & " - " & Me.Comune & " - " & Me.Azienda & ".pdf")
    End Sub
    i can't figure it out

  2. #2
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Can you please try one of the two below:
    Code:
    Private Sub EsportaBtn_Click()    
    Call EsportaProfilo(Screen.ActiveReport, Screen.ActiveReport.Name, "C:\Users\diego\OneDrive - Indipendente\Lavoro\HH\Candidati\" & Me.Regione & "\" & Me.NomeCognome & "\" & Me.NomeCognome & " - " & Me.Comune & " - " & Me.Azienda & ".pdf")
    'Call EsportaProfilo(Screen.ActiveReport,Application.CurrentObjectName, "C:\Users\diego\OneDrive - Indipendente\Lavoro\HH\Candidati\" & Me.Regione & "\" & Me.NomeCognome & "\" & Me.NomeCognome & " - " & Me.Comune & " - " & Me.Azienda & ".pdf")
    End Sub
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #3
    diegomarino is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    409
    the second one worked! thanks!
    can you explain me my error, if you want?

    EDIT it worked once (maybe i get confused)...then the problem is back


    Attempts:

    1) i tried to insert in the argument the name of the report as string and there is the same problem
    2) i used this code in the button click event (getting rid of the function)
    Code:
    Private Sub EsportaBtn_Click()   Dim FlName As String, Report As String
       Report = "ProfiloPB"
       FlName = "C:\Users\diego\OneDrive - Indipendente\Lavoro\HH\Candidati\" & Me.Regione & "\" & Me.NomeCognome & "\" & Me.NomeCognome & " - " & Me.Comune & " - " & Me.Azienda & ".pdf"
       DoCmd.OutputTo acOutputReport, Report, acFormatPDF, FlName, True
    End Sub
    and worked
    3) i tried to export by clicking with right button on the report in the navigation pane and worked too.


  4. #4
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    "Report" is a reserved word in Access and shouldn't be used for object names.

    I would use
    Code:
    Private Sub EsportaBtn_Click()
        Dim FlName As String
        Dim ReportName As String
    
        ReportName = "ProfiloPB"
        FlName = "C:\Users\diego\OneDrive - Indipendente\Lavoro\HH\Candidati\" & Me.Regione & "\" & Me.NomeCognome & "\" & Me.NomeCognome & " - " & Me.Comune & " - " & Me.Azienda & ".pdf"
        '  Debug.Print FlName
        DoCmd.OutputTo acOutputReport, ReportName, acFormatPDF, FlName, True
    
    End Sub
    or even better

    Code:
    Private Sub EsportaBtn_Click()
        Dim FlName As String
    
        FlName = "C:\Users\diego\OneDrive - Indipendente\Lavoro\HH\Candidati\" & Me.Regione & "\" & Me.NomeCognome & "\" & Me.NomeCognome & " - " & Me.Comune & " - " & Me.Azienda & ".pdf"
        '  Debug.Print FlName
        DoCmd.OutputTo acOutputReport, "ProfiloPB", acFormatPDF, FlName, True
    
    End Sub


    I don't know if this is the problem, but .........

  5. #5
    diegomarino is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    409
    thank you very much. However the problem is when i call the function by button press, not when i insert the code in the button click directly...maybe it is a too complex report, i give up on building a function...

    thanks everyone

Please reply to this thread with any new information or opinions.

Similar Threads

  1. New data on Form not showing on Report
    By PBCN in forum Reports
    Replies: 3
    Last Post: 06-09-2019, 06:19 PM
  2. Replies: 1
    Last Post: 01-23-2019, 01:55 PM
  3. Replies: 9
    Last Post: 08-08-2016, 02:57 PM
  4. Replies: 15
    Last Post: 04-16-2014, 01:15 PM
  5. Duplicate data not showing in report
    By ashu.doc in forum Reports
    Replies: 2
    Last Post: 09-19-2012, 05:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums