Results 1 to 10 of 10
  1. #1
    alyon is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2011
    Posts
    89

    Send Report to a NEW file

    In Access 2007 there a way to send a report to a file you create from the information in the form?



    Right now my code for the command button is:
    Dim strMyPath As String
    Dim strMyName As String
    strMyPath =" \\EB\EBMain\Digital Sender\ "
    strMyName = "Permit " & Me.[Permit Number].Value
    DoCmd.OpenReport "File Current Permit", acViewPreview, , "[ID] = " & Me.[ID]
    DoCmd.OutputTo acOutputReport, "File Current Permit", acFormatPDF, strMyPath + strMyName, False
    DoCmd.Close acReport, "File Current Permit"


    And that works perfect for sending the current report to the Digital Sender Folder... but I'd like to be able to send it to a certain county folder within the digital sender folder, based on what is listed for the county on the form. same for municipalities. and then, have it create a folder based on the name inside the form..... It seems possible to me, but I'm not sure how to lead it through the path of the folder through the given information on the form, or how to make it create a folder.

    Any suggestions would be greatly appreciated. Thank you in advance for your help.
    a lyon

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,924
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    alyon is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2011
    Posts
    89
    Well that makes since on how to create a folder... but that's not my whole issue... i'm having the issue of how to direct through, so that if the report says County: Tioga, the path takes it through \\EB\\EBMain\Digital and continues through to the Tioga County folder within the Digital folder. Once in there the folder will be created... it's getting there that seems to be the problem.
    Thanks for your help so far!! Any suggestions as to the rest of the problem?

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,924
    You will have to build the path with concatenation of the form controls.

    Are county and municipality folders in the same path? Are they selected from the same combobox. If county and municipality are separate comboboxes, how will you decide which one to use in the concatenation? Can user enter in both comboboxes? How you structure code depends on too many factors for me to be specific. Probably need some If Then Else conditional structure.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    alyon is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2011
    Posts
    89
    I guess the county doesn't matter, just what the municipality is...
    So if the Municipality is Covington (yes this is a combobox)

    I need it to go through the folder path:
    \\EB\EBMain\Digital Sender\Tioga\Covington

    But, if the Municipality is Osceola, I need it to go through the folder path:
    \\EB\EBMain\Digital Sender\Tioga\Osceola

    and then it needs to create a folder based on the name.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,924
    So did the links I provided help you structure code? You would refer to the combobox in concatenation of the path string.

    strPath = \\EB\EBMain\Digital Sender\Tioga\" & Me.combobox name.

    I am not able to help further for 2 weeks (vacation).
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    alyon is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2011
    Posts
    89
    I figured out through your links and research and the use of an IF statement to create the folder I want... but, I can not figure out how to get my report into the folder I just created.

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,924
    That's what the OutputTo should do. What is it about this command and its arguments that is not clear?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    alyon is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2011
    Posts
    89
    The Outputto function works just fine as far as outputting it, it's just it doesn't go INTO the folder I just created. It, instead, goes into the same folder the new folder was created in.

    For example:
    the path is = \\EB\EBMain\Digital Sender\Tioga\" & Me.[Owner Name].Value

    when I try to send the report there.. it only goes to \\EB\EBMain\Digital Sender\Tioga\" and not the new folder created titled with the owner name... the Me.[Owner Name].Value ends up getting set as the name of my report, in addition to the report name which is defined as the number.



    My actual code is listed below:

    Private Sub cmdFileReceipt_Click()
    Dim strMyPath As String
    If Me.cboMun.Value = "C-Town" Then
    strMyPath = \\EB\EBMain\Digital Sender\Tioga\C-Town" & Me.[Owner Name].Value
    End If
    If Me.cboMun.Value = "O-Town" Then
    strMyPath = "\\EB\EBMain\Digital Sender\Tioga\O-Town" & Me.[Owner Name].Value
    End If

    If Len(Dir(strMyPath, vbDirectory)) = 0 Then
    MkDir strMyPath
    End If

    Dim strMyName As String
    strMyName = "Receipt" & Me.txtNumber.Value
    DoCmd.OpenReport "File Current Permit", acViewPreview, , "[ID] = " & Me.[ID]
    DoCmd.OutputTo acOutputReport, "File Current Permit", acFormatPDF, strMyPath + strMyName, False
    DoCmd.Close acReport, "File Current Permit"
    End Sub


    and thanks for all your help so far!

  10. #10
    alyon is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2011
    Posts
    89
    Thank you again for all your help.. I solved it on my own.

    I listed my code below incase anyone else needs to know how to solve this!

    Private Sub cmdFileReceipt_Click()
    Dim strMyPath As String
    If Me.cboMun.Value = "C-Town" Then
    strMyPath = \\EB\EBMain\Digital Sender\Tioga\C-Town" & Me.[Owner Name].Value
    End If
    If Me.cboMun.Value = "O-Town" Then
    strMyPath = "\\EB\EBMain\Digital Sender\Tioga\O-Town" & Me.[Owner Name].Value
    End If

    If Len(Dir(strMyPath, vbDirectory)) = 0 Then
    MkDir strMyPath
    End If

    Dim strMyName As String
    Dim strPath As String
    If Me.cboMun.Value = "C-Town" Then
    strPath = \\EB\EBMain\Digital Sender\Tioga\C-Town" & Me.[Owner Name].Value & "\"
    End If
    If Me.cboMun.Value = "O-Town" Then
    strPath = "\\EB\EBMain\Digital Sender\Tioga\O-Town" & Me.[Owner Name].Value & "\"
    End If

    strMyName = "Receipt" & Me.txtNumber.Value
    DoCmd.OpenReport "File Current Permit", acViewPreview, , "[ID] = " & Me.[ID]
    DoCmd.OutputTo acOutputReport, "File Current Permit", acFormatPDF, strPath + strMyName, False
    DoCmd.Close acReport, "File Current Permit"
    End Sub

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

Similar Threads

  1. Help Send Report to File.
    By alyon in forum Access
    Replies: 4
    Last Post: 08-22-2011, 10:37 AM
  2. HELP! how to send data from table to text file
    By daveofgv in forum Import/Export Data
    Replies: 11
    Last Post: 02-14-2011, 01:22 AM
  3. send object report
    By ldappa in forum Access
    Replies: 1
    Last Post: 07-19-2010, 10:10 AM
  4. Send Primary Key from a Form To A Report
    By nkuebelbeck in forum Forms
    Replies: 1
    Last Post: 03-18-2010, 12:24 PM
  5. Replies: 0
    Last Post: 10-04-2009, 04:11 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