Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Report names entered automatically (2000)

    I am trying to produce various reports in Access and would like the names to be entered automatically (pdf report names) rather than keep having to enter them , as it is very time consuming , see attachment.

    Is there a way to do this?

    Justin.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Report names entered automatically (2000)

    Excuse my stupidity, but which application are you using to produce PDF files? Adobe Acrobat, or one of the cheaper alternatives (if so, which one)?

  3. #3
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Report names entered automatically (2000)

    Adobe Acrobat.

    Justin

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Report names entered automatically (2000)

    You can use the code from <post#=322094>post 322094</post#> to set the file name.
    Or you can accept the standard name and use code to rename the file (Name oldname As newname)

  5. #5
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Report names entered automatically (2000)

    Edited by HansV tomake URL clickable - see <!help=19>Help 19<!/help>

    I have a few questions:

    1. Where does this line of code go:

    SetPDFFileName "C:AccessTest.pdf"

    If l have several access filesnames l assue l just duplicate the line but change the report name.

    2. Where exactly does the coding go in the post:

    http://www.wopr.com/cgi-bin/w3t/showthread...l?Number=322094

    Justin.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Report names entered automatically (2000)

    The code between the two blue lines in that post should be copied into a standard module (created by clicking New in the Modules section of the database window)

    The line

    SetPDFFileName "C:AccessTest.pdf"

    (with the appropriate path and file name substituted) would be used in the On Click event procedure of a command button on a form, before exporting a report to PDF.

  7. #7
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Report names entered automatically (2000)

    When l create command button what action will it have?
    Once l know this l will test the coding and will see if it works.

    Justin.

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Report names entered automatically (2000)

    The code will set the default name for the next PDF file you will create.

  9. #9
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Report names entered automatically (2000)

    I am still a little confused as to what action l shall give the command button.
    i.e open form etc.

    Justin.

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Report names entered automatically (2000)

    Something like this (I don't have Adobe Acrobat, so I can't test it myself), assuming that the report has been set up to print to PDF:

    Private Sub cmdExportReport_Click()
    Dim strReportName As String
    ' Substitute appropriate names
    strReportName = "Important Report"
    SetPDFFileName "C:Action Reports" & strReportName & ".pdf"
    DoCmd.OpenReport strReportName
    End Sub

  11. #11
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Report names entered automatically (2000)

    I am bit confused as to what you mean?

    I understand where the code is to go , but do not know what the function of the command button is , see attached for what l mean.

    Justin.

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Report names entered automatically (2000)

    You can't use the Command Button Wizard for this, since this is not a standard action for command buttons You must cancel the wizard, then activate the Properties window.
    In the Format tab, specify the caption of the command button.
    In the Other tab, specify the name.
    In the Event tab, click in the On Click event.
    Select [Event Procedure] from the dropdown list
    Click the ... to the right of the dropdown arrow.
    This will take you to the Visual Basic Editor.
    Now enter of copy the VBA code for the command button, as in my previous reply.

  13. #13
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Report names entered automatically (2000)

    Thanks for that.
    Please can you tell me where l need to enter the names of the reports?
    I have 20 reports in total , therefore l have 20 report names.

    Justin.

  14. #14
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Report names entered automatically (2000)

    Where should l replace this procedure.
    So if l have reports call report1,report2 etc.
    I assume they would look like thi, see comments in ().

    Private Sub ExportPDF(ReportName As String()
    SetPDFFileName "C:Action Reports" & ReportName & ".pdf" ( i assume this is the location where the reports l stored?)
    DoCmd.OpenReport ReportName
    End Sub

    Private Sub cmdExportReport_Click()
    ExportPDF "report1t" (report 1)
    ExportPDF "report2" (report 2)
    ExportPDF "report3" (report 3)
    ...
    End Sub
    End Sub

    Justin

  15. #15
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Report names entered automatically (2000)

    You could create a procedure that takes the report name as an argument, and call it 20 times, each time with a different name. For example:

    Private Sub ExportPDF(ReportName As String()
    SetPDFFileName "C:Action Reports" & ReportName & ".pdf"
    DoCmd.OpenReport ReportName
    End Sub

    Private Sub cmdExportReport_Click()
    ExportPDF "This Report"
    ExportPDF "That Report"
    ExportPDF "Another Report"
    ...
    End Sub

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •