I sort of know what I need to do, I just can't seem to find any references online that are giving me exactly what I need... Or maybe I'm just not understanding it (which is probably likely).
So here's what I've got:
I have 3 separate tables (TblContactInfo and TblMailingList which hold contact information, and TblEntries with primary key ID that holds the data for each report I want to create and send). TblContactInfo holds names and corresponding email addresses (Primary key - EmailID), and TblMailingList stores which contacts are paired with which report (Primary keys - EmailID and ID).
I need to be able to loop through TblMailingList and be able to add each EmailID to a string that has a given value for the ID field.
Right now, this is what I've put together. I've somehow managed to never need to use a loop before, so the syntax is not familiar to me. LbxReportList is how the value for ID is selected.
I'd appreciate any help from anyone who can shed some light on this for me! Thanks!
So here's what I've got:
I have 3 separate tables (TblContactInfo and TblMailingList which hold contact information, and TblEntries with primary key ID that holds the data for each report I want to create and send). TblContactInfo holds names and corresponding email addresses (Primary key - EmailID), and TblMailingList stores which contacts are paired with which report (Primary keys - EmailID and ID).
I need to be able to loop through TblMailingList and be able to add each EmailID to a string that has a given value for the ID field.
Right now, this is what I've put together. I've somehow managed to never need to use a loop before, so the syntax is not familiar to me. LbxReportList is how the value for ID is selected.
Code:
Dim strEmailList As String
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("SELECT * FROM TblMailingList "WHERE [ID] = " & Me.LbxReportList)
Do Until rst.EOF
strEmailList = strEmailList & rst.Fields(EmailID) & "; "
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
Comment