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