Hello
I am tryung to send a report as an attachment. I ran into trouble only at the end, when I got an error after an attempt to view the attachment. Perhaps someone can see it:
Private Sub Report_Activate()
DoCmd.OutputTo acOutputReport, "DateChng", acFormatSNP, "H:\Dbases\Day_Prod\reports\DateChanges.snp", False
Dim CountData As Integer
Dim CountCartons As Integer
Dim DataAddress As String
Const cdoSendUsingMethod = " _
cdoSendUsingPort = 2, _
cdoSMTPServer = "
'// Create the CDO connections.
Dim iMsg, iConf, Flds
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
'// SMTP server configuration.
With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPort
'// Set the SMTP server address here.
.Item(cdoSMTPServer) = "192.168.30.140"
.Update
End With
'// Set the message properties.
With iMsg
Set .Configuration = iConf
.To = "mfg_update@SuperiorProd.com"
.From = "Production@SuperiorProd.com"
.Subject = "Date Changed Report"
End With
'// An attachment can be included.
iMsg.AddAttachment "H:\Dbases\Day_Prod\reports\DateChanged.snp"
'// Send the message.
iMsg.Send ' send the message.-
End Sub
I can view the file if I open it from the network, but not if I open it as the email attachment. Any ideas what could be wrong?
Many thanks
Jeremy
I am tryung to send a report as an attachment. I ran into trouble only at the end, when I got an error after an attempt to view the attachment. Perhaps someone can see it:
Private Sub Report_Activate()
DoCmd.OutputTo acOutputReport, "DateChng", acFormatSNP, "H:\Dbases\Day_Prod\reports\DateChanges.snp", False
Dim CountData As Integer
Dim CountCartons As Integer
Dim DataAddress As String
Const cdoSendUsingMethod = " _
cdoSendUsingPort = 2, _
cdoSMTPServer = "
'// Create the CDO connections.
Dim iMsg, iConf, Flds
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
'// SMTP server configuration.
With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPort
'// Set the SMTP server address here.
.Item(cdoSMTPServer) = "192.168.30.140"
.Update
End With
'// Set the message properties.
With iMsg
Set .Configuration = iConf
.To = "mfg_update@SuperiorProd.com"
.From = "Production@SuperiorProd.com"
.Subject = "Date Changed Report"
End With
'// An attachment can be included.
iMsg.AddAttachment "H:\Dbases\Day_Prod\reports\DateChanged.snp"
'// Send the message.
iMsg.Send ' send the message.-
End Sub
I can view the file if I open it from the network, but not if I open it as the email attachment. Any ideas what could be wrong?
Many thanks
Jeremy