Hi all,
I have recently taken over a project at work to develop a database from a colleague and have hit a stumbling block on the following module that was originally written to send an Access report as an e-mail attachment.
I have used it to add in a routine which saves a copy of the report on our network, and this part appears to be working reliably, however only some of our machines are successfully executing the code to send the report via e-mail using the SendObject command. All machines are running Office 2003 SP3 on Windows XP SP3.
The following is the module extracted to a text file:
I'm at a bit of a loss as to how this seems to be executing fine on some machines and not others, are there any known issues with the SendObject command in Office 2003 which would explain this behaviour and is there a better, more reliable method of achieving it?
I have recently taken over a project at work to develop a database from a colleague and have hit a stumbling block on the following module that was originally written to send an Access report as an e-mail attachment.
I have used it to add in a routine which saves a copy of the report on our network, and this part appears to be working reliably, however only some of our machines are successfully executing the code to send the report via e-mail using the SendObject command. All machines are running Office 2003 SP3 on Windows XP SP3.
The following is the module extracted to a text file:
Code:
Attribute VB_Name = "mdlSendEmail"
Option Compare Database
'sends rejection report e-mails and saves copy to shared area
Public Function Sendrpt3()
Dim variableCC As String
Dim Scheme As String
Dim Street As String
Dim Packref As String
Dim datestamp As String
Dim Filename As String
On Error Resume Next
Scheme = Forms!frmpackdata.txtAsset
Street = Forms!frmpackdata.TxtStreet
Packref = Forms!frmpackdata.txtPack
datestamp = Format(Now, "yyyyMMdd-hhmmss")
Filename = "network path\reports\" & datestamp & "-" & Packref & ".snp"
DoCmd.OutputTo acReport, "rptESRIReport", "SnapshotFormat(*.snp)", Filename, False, "", 0
If Forms!frmpackdata!txtCoord = "" Then
variableCC = ""
Else
variableCC = Forms!frmpackdata!txtCoord & "@companyname.com"
End If
' handle scenario where the above lines still only returns the e-mail domain name @companyname.com
If variableCC = "@companyname.com" Then
variableCC = ""
End If
DoCmd.SendObject acReport, "rptESRIReport", "SnapshotFormat(*.snp)", Forms!frmpackdata!txtOneNet & "@companyname.com", Forms!frmpackdata!txtTeamLeader & "@companyname.com" & "; " & variableCC, "di.audit@companyname.com", "QA Audit Rejection - Pack Ref " & Packref & ": " & Scheme & " - " & Street, "", True, ""
End Function
I'm at a bit of a loss as to how this seems to be executing fine on some machines and not others, are there any known issues with the SendObject command in Office 2003 which would explain this behaviour and is there a better, more reliable method of achieving it?