hey,
ok i have a form in access that can send emails using automation of outlook. i can type a message and a subject and click send . and outlook sends it, now i was wondering if i can have an attachment field within this form as well?
this is the module for the sendmsg function
************************************************************
Option Compare Database
Global Const STR_NULL1 As String = ""
Public Sub SendMsg(strSubject As String, _
strBody As String, _
strTo As String, _
Optional strCC As String = STR_NULL1, _
Optional strBCC As String = STR_NULL1)
Dim oLapp As Outlook.Application
Dim oItem As Outlook.MailItem
Set oLapp = CreateObject("Outlook.Application")
Set oItem = oLapp.CreateItem(0)
With oItem
.Subject = strSubject
.To = strTo
If Not IsMissing(strCC) And strCC <> STR_NULL1 Then
.CC = strCC
End If
If Not IsMissing(strBCC) And strBCC <> STR_NULL1 Then
.BCC = strBCC
End If
.Body = strBody
.Send
End With
Set oLapp = Nothing
Set oItem = Nothing
End Sub
************************************************************
ok i have a form in access that can send emails using automation of outlook. i can type a message and a subject and click send . and outlook sends it, now i was wondering if i can have an attachment field within this form as well?
this is the module for the sendmsg function
************************************************************
Option Compare Database
Global Const STR_NULL1 As String = ""
Public Sub SendMsg(strSubject As String, _
strBody As String, _
strTo As String, _
Optional strCC As String = STR_NULL1, _
Optional strBCC As String = STR_NULL1)
Dim oLapp As Outlook.Application
Dim oItem As Outlook.MailItem
Set oLapp = CreateObject("Outlook.Application")
Set oItem = oLapp.CreateItem(0)
With oItem
.Subject = strSubject
.To = strTo
If Not IsMissing(strCC) And strCC <> STR_NULL1 Then
.CC = strCC
End If
If Not IsMissing(strBCC) And strBCC <> STR_NULL1 Then
.BCC = strBCC
End If
.Body = strBody
.Send
End With
Set oLapp = Nothing
Set oItem = Nothing
End Sub
************************************************************