I have a problem. I have a database where I create two reports. I output them as snapshots, which works. I then create an email, through Lotus Notes to send a snapshot of the report.
My problem is with the attachment of the object. For one report it works fine, for another it doesn't. My code to run, save and send the report that isn't attaching a valid copy of the report to the email is:
Private Sub cmdRunReport_Click()
On Error GoTo Err_cmdRunReport_Click
Dim stDocName As String
Dim strAttach As String
stDocName = "Document Status"
strAttach = "C:\My_Data\JFMIP\DocStatus\Output\DS_Cycle" & Forms!frmDSSwitchboard!txtCycle & ".snp"
DoCmd.OpenReport stDocName, acPreview
DoCmd.OutputTo acOutputReport, stDocName, acFormatSNP, strAttach, True
DoCmd.SendObject acSendReport, stDocName, "Snapshot Format", "JFMIP Document Status", , , _
"Document Status Report for Cycle " & Forms!frmDSSwitchboard!txtCycle
Exit_cmdRunReport_Click:
Exit Sub
Err_cmdRunReport_Click:
MsgBox Err.Description
Resume Exit_cmdRunReport_Click
End Sub
My code to run, save and send the report that is attaching a valid copy of the report to the email is:
Private Sub cmdRunReport_Click()
On Error GoTo Err_cmdRunReport_Click
Dim stDocName As String
Dim strSave As String
stDocName = "FA_Merge_All"
DoCmd.OpenReport stDocName, acPreview
strSave = InputBox("Do you want to save the report? Y/N"
'If strSave = "y" Or strSave = "Y" Then
' DoCmd.OutputTo acOutputReport, stDocName, acFormatRTF, _
' "C:\My_Data\JFMIP\Funds_Av_Rpts\Compares\FA_Merge_C" & Forms!frmFASwitchboard!txtCycle & ".rtf", True
'End If
If strSave = "y" Or strSave = "Y" Then
DoCmd.OutputTo acOutputReport, stDocName, acFormatSNP, _
"C:\My_Data\JFMIP\Funds_Av_Rpts\Compares\FA_Cycle" & Forms!frmFASwitchboard!txtCycle & ".snp", True
DoCmd.SendObject acSendReport, strDocName, "Snapshot Format", "JFMIP Funds Availability", , , _
"Funds Availability Report for Cycle " & Forms!frmFASwitchboard!txtCycle
End If
Exit_cmdRunReport_Click:
Exit Sub
Err_cmdRunReport_Click:
MsgBox Err.Description
Resume Exit_cmdRunReport_Click
End Sub
The Document Status report is not attaching to the email. An Excel file with garbage in it is attaching. I don't understand. This is the same database and the same commands. Also, the Document Status worked earlier.
The only change that I can think about that I made to the Document Status report was add a running sum text box that put a number on each line in order to number the report. However, I took it off and tried to run the code again and I still get the same problem. I have also tried compacting and repairing the database. That doesn't help either.
Thank you for your help.
Tammy
Thank you for your help.
Tammy
My problem is with the attachment of the object. For one report it works fine, for another it doesn't. My code to run, save and send the report that isn't attaching a valid copy of the report to the email is:
Private Sub cmdRunReport_Click()
On Error GoTo Err_cmdRunReport_Click
Dim stDocName As String
Dim strAttach As String
stDocName = "Document Status"
strAttach = "C:\My_Data\JFMIP\DocStatus\Output\DS_Cycle" & Forms!frmDSSwitchboard!txtCycle & ".snp"
DoCmd.OpenReport stDocName, acPreview
DoCmd.OutputTo acOutputReport, stDocName, acFormatSNP, strAttach, True
DoCmd.SendObject acSendReport, stDocName, "Snapshot Format", "JFMIP Document Status", , , _
"Document Status Report for Cycle " & Forms!frmDSSwitchboard!txtCycle
Exit_cmdRunReport_Click:
Exit Sub
Err_cmdRunReport_Click:
MsgBox Err.Description
Resume Exit_cmdRunReport_Click
End Sub
My code to run, save and send the report that is attaching a valid copy of the report to the email is:
Private Sub cmdRunReport_Click()
On Error GoTo Err_cmdRunReport_Click
Dim stDocName As String
Dim strSave As String
stDocName = "FA_Merge_All"
DoCmd.OpenReport stDocName, acPreview
strSave = InputBox("Do you want to save the report? Y/N"
'If strSave = "y" Or strSave = "Y" Then
' DoCmd.OutputTo acOutputReport, stDocName, acFormatRTF, _
' "C:\My_Data\JFMIP\Funds_Av_Rpts\Compares\FA_Merge_C" & Forms!frmFASwitchboard!txtCycle & ".rtf", True
'End If
If strSave = "y" Or strSave = "Y" Then
DoCmd.OutputTo acOutputReport, stDocName, acFormatSNP, _
"C:\My_Data\JFMIP\Funds_Av_Rpts\Compares\FA_Cycle" & Forms!frmFASwitchboard!txtCycle & ".snp", True
DoCmd.SendObject acSendReport, strDocName, "Snapshot Format", "JFMIP Funds Availability", , , _
"Funds Availability Report for Cycle " & Forms!frmFASwitchboard!txtCycle
End If
Exit_cmdRunReport_Click:
Exit Sub
Err_cmdRunReport_Click:
MsgBox Err.Description
Resume Exit_cmdRunReport_Click
End Sub
The Document Status report is not attaching to the email. An Excel file with garbage in it is attaching. I don't understand. This is the same database and the same commands. Also, the Document Status worked earlier.
The only change that I can think about that I made to the Document Status report was add a running sum text box that put a number on each line in order to number the report. However, I took it off and tried to run the code again and I still get the same problem. I have also tried compacting and repairing the database. That doesn't help either.
Thank you for your help.
Tammy
Thank you for your help.
Tammy