As far as I know it is not possible to link emails to access.
However it is possible to store an email on a harddisk and save the location of the email in a field.
Remark: this code is written for outlook 2003 and access 2003. In order to work you need to include the 'Microsoft Outlook 11.0 Object library' in the references.
To add this reference, click in the vba-screen on Tools - References. Select 'Microsoft Outlook 11.0 Object library' to include the library.
I suppose you want to store one mail per record, so you would have a form with the textbox txtEmail and a commandbutton cmdAddmail
Private Sub cmdAddmail_Click()
txtEmail.value = Linkemail
end Sub
Below is the code which will send the full pathname and file to the textbox
Public Function LinkEmail()
'Description: determin the active mail, save it to server as msg-file
'and return the location to the caller
On Error GoTo Action_Err
'Variables
Dim myEmail As Inspector
Dim SaveEmail As Object
Dim strName As String
'Search for open mail
Set myEmail = Outlook.Application.ActiveInspector
If Not TypeName(myEmail) = "Nothing" Then
Set SaveEmail = myEmail.CurrentItem
SaveEmail.SaveAs "Enter path here (filename included) as string", olMSG
LinkEmail = strName
Else
MsgBox "No open mail has been detected" & Chr(13) & _
"If you wish to add an email, you will have " & Chr(13) & _
"to open the mail.", vbOKOnly, "No open mail detected"
End If
Action_Exit:
Exit Function
Action_Err:
'Error handling
MsgBox Err.description
GoTo Action_Exit
End Function
This function will copy the email as message to the place you defined, and create a string which will be stored in the the textbox.
Some practical issues with this method:
1/ the function will only work when the email-message is open.
2/ if you have opened multiple message, only the last opened message will be saved.