Results 1 to 3 of 3
  1. #1
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727

    weird export

    All, using access 2010. Something weird is going on with my export. I have the following code:

    Code:
    Private Sub cmdExportLetters_Click()
    Dim myPath As String
    Dim strReportName1 As String
    Dim strReportName2 As String
    Dim strReportName3 As String
    Dim strReportName4 As String
     
    DoCmd.OpenReport "rptFaxLetterNEW", acViewPreview
    DoCmd.OpenReport "rptFaxLetterREVISED", acViewPreview
    DoCmd.OpenReport "rptLetterNEW", acViewPreview
    DoCmd.OpenReport "rptLetterREVISED", acViewPreview
     
    myPath = "C:\Project\Letters "
     
    strReportName1 = Format(Date, "yyyy mm dd" & " " & "rptFaxLetterNEW") & ".Pdf"
    strReportName2 = Format(Date, "yyyy mm dd" & " " & "rptFaxLetterREVISED") & ".Pdf"
    strReportName3 = Format(Date, "yyyy mm dd" & " " & "rptLetterNEW") & ".Pdf"
    strReportName4 = Format(Date, "yyyy mm dd" & " " & "rptLetterREVISED") & ".Pdf"
     
    DoCmd.OutputTo acOutputReport, "", acFormatPDF, myPath & "\" & strReportName1, False
    DoCmd.OutputTo acOutputReport, "", acFormatPDF, myPath & "\" & strReportName2, False
    DoCmd.OutputTo acOutputReport, "", acFormatPDF, myPath & "\" & strReportName3, False
    DoCmd.OutputTo acOutputReport, "", acFormatPDF, myPath & "\" & strReportName4, False
    DoCmd.Close acReport, "rptFaxLetterNEW"
    DoCmd.Close acReport, "rptFaxLetterREVISED"
    DoCmd.Close acReport, "rptLetterNEW"
    DoCmd.Close acReport, "rptLetterREVISED"
    
    End Sub


    It runs great except what’s supposed to be a set of new letters and a set of revised letters turns out to be all new or revised. When I go to the folder and click on new letters it’s the revised letters. So I thought I got them mixed up. When I click on the revised letters; they are the revised. So I thought maybe I used the same query for the new letters. But I went to my database and it’s pointing to the correct queries. I tried changing the order of the output and I end up with all new letters not revised letters. I hope I didn’t confuse anyone. Can anyone explain what’s going on?? Thanks

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Dont you need the report name where you have a blank..
    DoCmd.OutputTo acOutputReport, "", acFormatPDF, myPath & "\" & strReportName1, False
    should be:
    DoCmd.OutputTo acOutputReport, "rptLetterREVISED", acFormatPDF, myPath & "\" & strReportName1, False

  3. #3
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    AHH. I just assumed my code was correct because the files were exporting. Thanks!

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

Similar Threads

  1. I have a question maybe somewhat weird
    By azhar2006 in forum Access
    Replies: 3
    Last Post: 03-04-2014, 03:34 AM
  2. Weird Speed issue
    By devlin7 in forum Access
    Replies: 12
    Last Post: 02-09-2014, 07:32 PM
  3. Another Weird Problem
    By ksmith in forum Access
    Replies: 16
    Last Post: 07-24-2012, 10:45 AM
  4. Weird Problem
    By ksmith in forum Access
    Replies: 5
    Last Post: 11-09-2011, 11:26 AM
  5. Weird Error
    By KevinMCB in forum Access
    Replies: 1
    Last Post: 02-16-2011, 02:23 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