Hyperlinked File as Attachment in email

steve21nj

Registered User.
Local time
Today, 13:45
Joined
Sep 11, 2012
Messages
260
Curious if this is possible…

I have two text boxes named [Attachment] and [Attachment2] that store a hyperlink to the file on a shared drive. So it is not an actual attachment, just a link to the attachment. Is there a way to capture the file within these two text boxes and email the contents? (My email help attachment represents what I'd like to happen)

It is safe to assume that there could be zero, one, or two hyperlinks present. For example:

Zero
First Text Box Name = Attachment = Null
Second Text Box Name = Attachment2 = Null

One (my attached image represents this)
First Text Box Name = Attachment = F:/Users/AccessD/help.doc
Second Text Box Name = Attachment2 = Null

Two
First Text Box Name = Attachment = F:/Users/AccessD/help.doc
Second Text Box Name = Attachment2 = F:/Users/AccessD/answer.doc
I’ve worked with the below code to send a form but never the hyperlinked attachment link in the text box. Any suggestions?

Code:
[FONT=Arial]DoCmd.SendObject acSendForm, "FormName", ,, , , , , , , True[/FONT]

The On_Click for the attachment code: (might not be needed but just in case)
Code:
[FONT=Arial]Private Sub cmdInsertHyper_Click()[/FONT]
[FONT=Arial]On Error GoTo Errhandler[/FONT]
[FONT=Arial]Attachment.SetFocus[/FONT]
[FONT=Arial]DoCmd.RunCommand acCmdInsertHyperlink[/FONT]
[FONT=Arial]Exit Sub[/FONT]
[FONT=Arial]Errhandler:[/FONT]
[FONT=Arial]Select Case Err[/FONT]
[FONT=Arial]Case 2046[/FONT]
[FONT=Arial]'Command not available[/FONT]
[FONT=Arial]MsgBox "You must select an OLE field before running this procedure.", vbCritical, "Not Available"[/FONT]
[FONT=Arial]Case 2501[/FONT]
[FONT=Arial]'Cancel selected in dialog box - do nothing[/FONT]
[FONT=Arial]Case Else[/FONT]
[FONT=Arial]MsgBox Err.Number & ":-" & vbCrLf & Err.Description[/FONT]
[FONT=Arial]End Select[/FONT]
[FONT=Arial]End Sub[/FONT]
 

Attachments

  • help.PNG
    help.PNG
    5 KB · Views: 108
  • email help.PNG
    email help.PNG
    94.5 KB · Views: 106

Users who are viewing this thread

Back
Top Bottom