I need help with the following code.
I am trying to extract two reports at the same time, but I want the viewer to see the report first before exporting it. The reason is in case the report is null. There are two reports, one for 2006 and one for 2007.
Problem is when I tried making a Msgbox if statement, it does not work correctly. I want the user to say "yes or no" to extract report and then continue from there.
I can't get either working. Any help will be apperciated.
If there is a simpler way where I tried to export both reports to a folder but does NOT export null reports (reports with no data) that would even be better.
If (Plan_Year) = "Both Plan Years" Then
stDocName = "Plan Type Checks1"
DoCmd.OpenQuery stDocName, acNormal, acEdit
If MsgBox("Extract Report to Client Folder?", vbYesNo) = vbYes Then
stDocName = "Plan Type Checks1"
stFileName = "X:\Clients\C\C DI\2007\Outsour cing\FSA\ "
stFileName = stFileName & Format(Check_Da te, "yyyy-mm-dd") & " " & "CDI 2006 FSA Checks Printed"
stFileName = stFileName & ".xls"
stDocName = "Plan Type Checks1"
DoCmd.OutputTo acOutputQuery, "Plan Type Checks1", acSpreadsheetTy peExcel9, stFileName, False
stDocName = "Plan Type Checks2"
DoCmd.OpenQuery stDocName, acNormal, acEdit
If MsgBox("Extract Report to Client Folder?", vbYesNo) = vbYes Then
stDocName = "Plan Type Checks2"
stFileName = "X:\Clients\C\C DI\2007\Outsour cing\FSA\ "
stFileName = stFileName & Format(Check_Da te, "yyyy-mm-dd") & " " & "CDI 2007 FSA Checks Printed"
stFileName = stFileName & ".xls"
stDocName = "Plan Type Checks2"
DoCmd.OutputTo acOutputQuery, "Plan Type Checks2", acSpreadsheetTy peExcel9, stFileName, False
If MsgBox("CDI FSA Check Printed Reports Exported to X:\Clients\C\CD I\2007\Outsourc ing\FSA. Go to CDI FSA Report folder?", vbYesNo) = vbYes Then
FollowHyperlink "X:\Clients\C\C DI\2007\Outsour cing\FSA "
End If
I am trying to extract two reports at the same time, but I want the viewer to see the report first before exporting it. The reason is in case the report is null. There are two reports, one for 2006 and one for 2007.
Problem is when I tried making a Msgbox if statement, it does not work correctly. I want the user to say "yes or no" to extract report and then continue from there.
I can't get either working. Any help will be apperciated.
If there is a simpler way where I tried to export both reports to a folder but does NOT export null reports (reports with no data) that would even be better.
If (Plan_Year) = "Both Plan Years" Then
stDocName = "Plan Type Checks1"
DoCmd.OpenQuery stDocName, acNormal, acEdit
If MsgBox("Extract Report to Client Folder?", vbYesNo) = vbYes Then
stDocName = "Plan Type Checks1"
stFileName = "X:\Clients\C\C DI\2007\Outsour cing\FSA\ "
stFileName = stFileName & Format(Check_Da te, "yyyy-mm-dd") & " " & "CDI 2006 FSA Checks Printed"
stFileName = stFileName & ".xls"
stDocName = "Plan Type Checks1"
DoCmd.OutputTo acOutputQuery, "Plan Type Checks1", acSpreadsheetTy peExcel9, stFileName, False
stDocName = "Plan Type Checks2"
DoCmd.OpenQuery stDocName, acNormal, acEdit
If MsgBox("Extract Report to Client Folder?", vbYesNo) = vbYes Then
stDocName = "Plan Type Checks2"
stFileName = "X:\Clients\C\C DI\2007\Outsour cing\FSA\ "
stFileName = stFileName & Format(Check_Da te, "yyyy-mm-dd") & " " & "CDI 2007 FSA Checks Printed"
stFileName = stFileName & ".xls"
stDocName = "Plan Type Checks2"
DoCmd.OutputTo acOutputQuery, "Plan Type Checks2", acSpreadsheetTy peExcel9, stFileName, False
If MsgBox("CDI FSA Check Printed Reports Exported to X:\Clients\C\CD I\2007\Outsourc ing\FSA. Go to CDI FSA Report folder?", vbYesNo) = vbYes Then
FollowHyperlink "X:\Clients\C\C DI\2007\Outsour cing\FSA "
End If
Comment