lassehammer
IS-IT--Management
Hi There,
I've just started using code in my Access databases. I've managed to write code which allows me to automatically send emails from a click box on an access form. However I need to find a way of specifying which email account to send the email from.
The code I have at present is ..
Any help will be greatfully apppreciated
Regards
Lasse
I've just started using code in my Access databases. I've managed to write code which allows me to automatically send emails from a click box on an access form. However I need to find a way of specifying which email account to send the email from.
The code I have at present is ..
Code:
Private Sub SendMail(strTo As String, strSub As String, strMsg1 As String, strMsg2 As String, strMsg3 As String, strMsg4 As String, strMsg5)
Dim olApp As Outlook.Application
Dim olMessage As MailItem
Set olApp = CreateObject("Outlook.Application")
Set olMessage = olApp.CreateItem(olMailItem)
olMessage.To = strTo
olMessage.Subject = strSub
olMessage.Body = strMsg1 & vbCrLf & vbCrLf & strMsg2 & vbCrLf & vbCrLf & strMsg3 & vbCrLf & vbCrLf & strMsg4 & vbCrLf & vbCrLf & strMsg5
olMessage.Send
Set olApp = Nothing
Set olNS = Nothing
Set olMessage = Nothing
End Sub
Any help will be greatfully apppreciated
Regards
Lasse