My software has an internal email module and I've figured out how to send mail via SMTP and to include attachments and of course the client wants to see what attachments were sent.
The problem is that SMTP sends the attachment by virtue of setting a path to the file being sent, and my software, being an MS Access application, works with document attachments via the OLE field and the Insert Object command to load the document into a MYSQL LongBlob field via a form with a OLE field.
So my table that stores any attachments to the email has two fields, a text field for the path the user selected to send the attachment via SMTP, and a LongBlob/OLE field the user has to make a second effort using right click, "Insert Object," and then browsing to hopefully the same file, thus having to browse twice for an attachment if they want it saved after sending via SMTP.
I built integration with MS Outlook, which would solve the issue for this client, but this client is using the 64 bit version of MS Office 2013, and my Office 365 64 bit Office version of Access seems to have updated to Office 16 when I wasn't looking and that broke my Outlook integration from working with their 64 bit Access 2013 runtime installations when I deploy the 64 bit version.
Not the end of the world, but I was wondering if anyone can think of a clever way to make this into a single attachment browse effort by either:
1. Exposing the path of the OLE Object after Inserting it into the text field that SMTP uses, or
2. Getting the attachment into the OLE Field as a result of setting the path to the attachment for SMTP
Or maybe the easier way out of this is to fix the Outlook object library compatibility..... Can I install 64 bit Access 2103 on a computer running 64 bit 365 Office (click-to-run) I'm thinking probably not....
Here is the code for my button that sets the path to the attachment for SMTP:
Private Sub Command144_Click()
On Error GoTo Err_Command144_Click
Dim F As Object
Dim i As Integer
Set F = Application.FileDialog(3)
F.AllowMultiSelect = True
If F.Show Then
For i = 1 To F.SelectedItems.Count
MailSendAttach = FindFilename(F.SelectedItems(i)) 'Sets the value of global constant MailSendAttach that the query below uses
'to add it to the e-mail attachment table
DoCmd.OpenQuery "Qry_MailSendAddAttachment" 'Adds the path to the attachment table later used by CDO mail send via SMTP
Me!AttachmentCombo.Requery 'Drop down list of attachments to this email
Me![AttachCount] = DCount("*", "Qry_MailSendAttachCombo")
Me![AttachCountSave] = DCount("*", "Qry_MailSendAttachComboAttached")
MsgBox ("Select the attachment to save it after sending.")