brorick
10-22-2007, 07:18 AM
I have successfully created the necessary code to send an email from Access. The problem I am having is trying to send an attachment. I have a field that identifies the attachment in my table (rst![Attachments]). The user is given the option to include an attachment only when necessary, therefore there may be many records that do not include an attachment. My code works perfectly when there is an attachment. :doh: I am trying to compensate for the senario when there is no attachment. I am using the following code and I am not having any success. I am hoping someone has an excellent example. Your help is greatly appreciated. Thank you in advance.
Dim objOutlookMsg As Outlook.MailItem
Dim strAttach As String
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("Qry_Bulletins_Report")
If Not IsNull(strAttach) Then
strAttach = rst![Attachments]
objOutlookMsg.Attachments.Add strAttach
End If
Dim objOutlookMsg As Outlook.MailItem
Dim strAttach As String
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("Qry_Bulletins_Report")
If Not IsNull(strAttach) Then
strAttach = rst![Attachments]
objOutlookMsg.Attachments.Add strAttach
End If