F
fgibbcollins
I've created a form that captures a selected email from an Outlook View
Control, copies its sender, subject and body into a memo field; then extracts
attachments to a specified folder. I have a subform that is meant to hold a
hyperlink to the downloaded attachment, but if there are multiple attachments
then it simply copies over the first attachment path. How can I force it to
move to the next record? I tried inserting a Gotorecord, acnew, but it tells
me the subform isn't open. Any help would be greatly appreciated. Thanks,
Frank
Here is my code:
With OutlookViewCtl
Set CopyItem = OutlookViewCtl.Selection
Set sMail = CreateObject("Redemption.SafeMailItem")
i = 0
For Each itm In CopyItem
sMail.item = itm
Notes = "**Received Email**" & vbCrLf & "From: " & sMail.SenderName
& vbCrLf & "To: " & sMail.ReceivedByName & vbCrLf & sMail.Body & vbCrLf &
"CCed: " & sMail.CC
NotesDate = sMail.ReceivedTime
Form_frmContactWith!ContactWith = sMail.SenderName
For Each att In itm.Attachments
FileName = "C:\Utility Relocation\Job Folders\" &
Form_frmMainDetails!JobNumber & "\" & NotesPK & "_" & att.DisplayName
att.SaveAsFile FileName
Me!frmIncomingAttachments!IncomingAttachment = FileName
Me!frmIncomingAttachments!NotesIncomingAttFK = Me!NotesPK
i = i + 1
Next att
Next itm
End With
Control, copies its sender, subject and body into a memo field; then extracts
attachments to a specified folder. I have a subform that is meant to hold a
hyperlink to the downloaded attachment, but if there are multiple attachments
then it simply copies over the first attachment path. How can I force it to
move to the next record? I tried inserting a Gotorecord, acnew, but it tells
me the subform isn't open. Any help would be greatly appreciated. Thanks,
Frank
Here is my code:
With OutlookViewCtl
Set CopyItem = OutlookViewCtl.Selection
Set sMail = CreateObject("Redemption.SafeMailItem")
i = 0
For Each itm In CopyItem
sMail.item = itm
Notes = "**Received Email**" & vbCrLf & "From: " & sMail.SenderName
& vbCrLf & "To: " & sMail.ReceivedByName & vbCrLf & sMail.Body & vbCrLf &
"CCed: " & sMail.CC
NotesDate = sMail.ReceivedTime
Form_frmContactWith!ContactWith = sMail.SenderName
For Each att In itm.Attachments
FileName = "C:\Utility Relocation\Job Folders\" &
Form_frmMainDetails!JobNumber & "\" & NotesPK & "_" & att.DisplayName
att.SaveAsFile FileName
Me!frmIncomingAttachments!IncomingAttachment = FileName
Me!frmIncomingAttachments!NotesIncomingAttFK = Me!NotesPK
i = i + 1
Next att
Next itm
End With