Arcadia
04-03-2014, 06:26 AM
Hi everyone i have a question and really hope someone can help me out:
In acces i have made a form with several records, the information in those records are send out to the body of a email message in Outlook i did that by a VBA code so if a users presses on that button it will do the job, but the problem is that it only picks the data of the current record and not all records of the form.
Is there a way to edit my VBA code so i will be able to this?
Private Sub Send_Mail_Click()
Set fso = CreateObject("Scripting.FileSystemObject")
Set olObj = GetObject(, "Outlook.Application")
Set olmail = olObj.createitem(olMailItem)
olmail.Subject = "Training"
olmail.Importance = "2"
olmail.To = ""
olmail.cc = ""
olmail.bcc = ""
olmail.htmlbody = "<p> Hello, here are the dates</p> " & vbNewLine & vbNewLine & "Title:" & " " & [Title] & vbNewLine & "Location:" & " " & [Location] & vbNewLine & "Start Time:" & " " & [Start Time] & vbNewLine & "End Time:" & " " & [End Time] & vbNewLine & vbNewLine & "Description:" & " " & [Description] & vbNewLine
Email_Subject = "Training dates"
olmail.display
On Error GoTo debugs
Set Mail_Object = CreateObject("Outlook.Application")
Set Mail_Single = Mail_Object.createitem(0)
With Mail_Single
.Subject = Email_Subject
.To = Email_Send_To
.cc = Email_Cc
.bcc = Email_Bcc
.Body = Email_Body
.send
End With
debugs:
If Err.Description <> "" Then MsgBox Err.Description
End If
In acces i have made a form with several records, the information in those records are send out to the body of a email message in Outlook i did that by a VBA code so if a users presses on that button it will do the job, but the problem is that it only picks the data of the current record and not all records of the form.
Is there a way to edit my VBA code so i will be able to this?
Private Sub Send_Mail_Click()
Set fso = CreateObject("Scripting.FileSystemObject")
Set olObj = GetObject(, "Outlook.Application")
Set olmail = olObj.createitem(olMailItem)
olmail.Subject = "Training"
olmail.Importance = "2"
olmail.To = ""
olmail.cc = ""
olmail.bcc = ""
olmail.htmlbody = "<p> Hello, here are the dates</p> " & vbNewLine & vbNewLine & "Title:" & " " & [Title] & vbNewLine & "Location:" & " " & [Location] & vbNewLine & "Start Time:" & " " & [Start Time] & vbNewLine & "End Time:" & " " & [End Time] & vbNewLine & vbNewLine & "Description:" & " " & [Description] & vbNewLine
Email_Subject = "Training dates"
olmail.display
On Error GoTo debugs
Set Mail_Object = CreateObject("Outlook.Application")
Set Mail_Single = Mail_Object.createitem(0)
With Mail_Single
.Subject = Email_Subject
.To = Email_Send_To
.cc = Email_Cc
.bcc = Email_Bcc
.Body = Email_Body
.send
End With
debugs:
If Err.Description <> "" Then MsgBox Err.Description
End If