mike60smart
Registered User.
- Local time
- Today, 18:04
- Joined
- Aug 6, 2017
- Messages
- 1,904
Hi Everyone
I currently have a process that links to an Outlook Folder.
These emails are then parsed into a table and displayed on a Form.
I then have a Command Button that splits the email data into fields in a table and displayed on a Form named "frmTwo"
I then have a Command Button that inserts this data into 2 tables and this works just fine.
Each record on the Continuous Form has a Control named "ContactEmail"
How would I be able to send an email to each of the individual email address's??
Any help appreciated.
The code on the Command Button at the moment is as follows:-
I currently have a process that links to an Outlook Folder.
These emails are then parsed into a table and displayed on a Form.
I then have a Command Button that splits the email data into fields in a table and displayed on a Form named "frmTwo"
I then have a Command Button that inserts this data into 2 tables and this works just fine.
Each record on the Continuous Form has a Control named "ContactEmail"
How would I be able to send an email to each of the individual email address's??
Any help appreciated.
The code on the Command Button at the moment is as follows:-
Code:
Private Sub cmdIn_Click()
On Error GoTo cmdIn_Click_Error
Me.RecordsetClone.Filter = "[Updated] = -1"
Test Me.RecordsetClone.OpenRecordset
Exit Sub
cmdIn_Click_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdIn_Click of Sub Form_frmTwo"
End Sub
Sub Test(rs As DAO.Recordset)
On Error GoTo Test_Error
If Me.Dirty Then Me.Dirty = False
Dim dbsMydbs As DAO.Database
Dim rstMyTable As DAO.Recordset
Dim rstOtherTable As DAO.Recordset
Dim strSQL As String
Dim lngOrgOpenCourseBookingID As Long
Dim VariableName As Long
lngOrgOpenCourseBookingID = VariableName
Set dbsMydbs = CurrentDb
Set rstMyTable = dbsMydbs.OpenRecordset("tblOrganisationOpenCourseBooking")
Set rstOtherTable = dbsMydbs.OpenRecordset("tblGroupCourseParticipants")
If rs.EOF Then
MsgBox "No recs"
Else
With rs
.MoveLast
.MoveFirst
MsgBox .RecordCount
Do Until .EOF
rstMyTable.AddNew
rstMyTable!ShortCourseBookingID = Me.txtShortCourseBookingID
rstMyTable!ContactFirstName = Me.ContactFirstName
rstMyTable!ContactSurname = Me.ContactSurname
rstMyTable!ContactEMail = Me.ContactEMail
rstMyTable!ContactPhoneNumber = Me.ContactPhone
rstMyTable!OrganisationNameID = Me.txtOrg
rstMyTable!Address = Me.txtOrgAddress
rstMyTable!BillingAddress = Me.txtBillingAddress
rstMyTable!NrPlacesBooked = Me.NrofParticipants
rstMyTable!PONumber = Me.PONumber
rstMyTable!Comments = Me.AdditionalComments
rstMyTable!RecordID = Me.id
rstMyTable.Update
rstMyTable.Bookmark = rstMyTable.LastModified
VariableName = rstMyTable!OrgOpenCourseBookingID
If Len(ParticipantName1 & vbNullString) > 0 Then
rstOtherTable.AddNew
rstOtherTable!OrgOpenCourseBookingID = VariableName
rstOtherTable!ParticipantName = ParticipantName1
rstOtherTable.Update
End If
If Len(ParticipantName2 & vbNullString) > 0 Then
rstOtherTable.AddNew
rstOtherTable!OrgOpenCourseBookingID = VariableName
rstOtherTable!ParticipantName = ParticipantName2
rstOtherTable.Update
End If
If Len(ParticipantName3 & vbNullString) > 0 Then
rstOtherTable.AddNew
rstOtherTable!OrgOpenCourseBookingID = VariableName
rstOtherTable!ParticipantName = ParticipantName3
rstOtherTable.Update
End If
If Len(ParticipantName4 & vbNullString) > 0 Then
rstOtherTable.AddNew
rstOtherTable!OrgOpenCourseBookingID = VariableName
rstOtherTable!ParticipantName = ParticipantName4
rstOtherTable.Update
End If
If Len(ParticipantName5 & vbNullString) > 0 Then
rstOtherTable.AddNew
rstOtherTable!OrgOpenCourseBookingID = VariableName
rstOtherTable!ParticipantName = ParticipantName5
rstOtherTable.Update
End If
.MoveNext
Loop
End With
End If
MsgBox "Participants have been added.", vbInformation, "Complete"
DoCmd.RunMacro "mcrDeleteTable2True"
On Error GoTo 0
Exit Sub
Test_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Test of Sub Form_frmTwo"
End Sub