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 do this?
The code that i currently using is below:
Expand|Select|Wrap|Line Numbers
- 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