Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228

    Putting reports in the right folder.

    Once I have generated reports in access; I want them to go in the relevant folder on the drive. Is there any possibility of having access put the right report in the right folder? I don't have any suggestions on how to achieve this Its just a general question.

    Cheers Andy,

    Additionally, EVERY "JOB" in the jobs table will have a folder. Can I simply assign the folder to the job and when a report is made for that job it would go there?

    To make things a little more difficult. (although this can be changed) Jobs are split up in my file structure depending on which project they are under.



    But any suggestions or possible solutions will be listened too. Even if it requires changing the file structure.

  2. #2
    knarfreppep is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Feb 2015
    Location
    Adelaide, Australia
    Posts
    106
    You could call the Sub below with this -

    gsubPublishReport "Boat_Fred", lngJob, "rptItemsToPurchase", "ItemsToPurchase_" & Format(lngJob,"00000000")

    Public Sub gsubPublishReport( _
    ByVal strProject As String, _
    ByVal lngJob As Long, _
    ByVal strReportName As String, _
    ByVal strFileName As String)

    On Error GoTo Error_gsubPublishReport

    Const pcPATH_FOR_REPORTS = "C:\MyApplicationReports\"

    MkDir pcPATH_FOR_REPORTS & strProject & "\Job_" & Format(lngJob, "00000000")

    DoCmd.OutputTo acOutputReport, strReportName, acFormatPDF, pcPATH_FOR_REPORTS & strProject & "\Job_" & Format(lngJob, "00000000") & "\" & Format(Date, "yyyymmdd_") & strFileName & ".pdf"

    Exit_gsubPublishReport:
    Exit Sub

    Error_gsubPublishReport:
    Select Case Err
    Case 75 ' new directory already exists
    Resume Next
    Case Else
    MsgBox Err.Number & " : " & Err.Description
    End Select
    Resume Exit_gsubPublishReport:

    End Sub


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

Similar Threads

  1. Replies: 1
    Last Post: 05-15-2015, 10:58 AM
  2. Replies: 1
    Last Post: 08-02-2013, 10:38 AM
  3. Replies: 4
    Last Post: 06-27-2013, 12:29 PM
  4. open folder/Make new folder(example)-VBA Code
    By Madmax in forum Code Repository
    Replies: 3
    Last Post: 03-13-2012, 09:17 AM
  5. Enter a folder name and open that folder
    By pkstormy in forum Code Repository
    Replies: 0
    Last Post: 09-05-2010, 04:39 PM

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