S
slpixie
Hi, I have an Access 2003 DB for contracts. I have a query, for each person
responsible for a contract, that lists all upcoming contract due dates with
specific time frames. Some times a person's query might result in no records.
There is a report generated based on each of the queries. I have code to
send an email but I do not want to send the email if there is nothing to
attach. That part of the code needs help as it doesn't work. Thanks in
advance.
Function MailParameters()
Dim outApp As Outlook.Application, outMsg As MailItem
Dim Cancel As Boolean
Set outApp = CreateObject("Outlook.Application")
Set outMsg = outApp.CreateItem(olMailItem)
With outMsg
.Importance = olImportanceHigh
.To = "(e-mail address removed)"
.CC = "(e-mail address removed)"
.BCC = "(e-mail address removed)"
.Subject = "Outlook Test Code Seven"
.Body = "Testing code for Access to Outlook"
On Error Resume Next
.Attachments.Add _
"G:\Accounting\CDImportNumbers\CDImportNumbers.xls"
If Attachment.Count = 0 Then
Cancel = True
Else: .Send
End If
End With
Set outApp = Nothing
Set outMsg = Nothing
End Function
responsible for a contract, that lists all upcoming contract due dates with
specific time frames. Some times a person's query might result in no records.
There is a report generated based on each of the queries. I have code to
send an email but I do not want to send the email if there is nothing to
attach. That part of the code needs help as it doesn't work. Thanks in
advance.
Function MailParameters()
Dim outApp As Outlook.Application, outMsg As MailItem
Dim Cancel As Boolean
Set outApp = CreateObject("Outlook.Application")
Set outMsg = outApp.CreateItem(olMailItem)
With outMsg
.Importance = olImportanceHigh
.To = "(e-mail address removed)"
.CC = "(e-mail address removed)"
.BCC = "(e-mail address removed)"
.Subject = "Outlook Test Code Seven"
.Body = "Testing code for Access to Outlook"
On Error Resume Next
.Attachments.Add _
"G:\Accounting\CDImportNumbers\CDImportNumbers.xls"
If Attachment.Count = 0 Then
Cancel = True
Else: .Send
End If
End With
Set outApp = Nothing
Set outMsg = Nothing
End Function