Hello you smart people out there,
I wonder if you can help me with a problem I am having. I have created code to 'look' at a table with E-mail addresses in, to loop through the records and list the e-mail addresses within a certain criteria. I have had this working ok but not all of the records are shown in the table so when the ID sequence that the loop is looking at is broken such as RecordsID 1, 2, 3, 4, 7, 8 the loop stops and it shows an error. This is the code that I have:
Can anyone see how to modify this code to enable the search to include or skip the non-existant record?
Hope you can help
Regards
InkyRich
A fool and his money are soon parted - so you might as well send it to me!
I wonder if you can help me with a problem I am having. I have created code to 'look' at a table with E-mail addresses in, to loop through the records and list the e-mail addresses within a certain criteria. I have had this working ok but not all of the records are shown in the table so when the ID sequence that the loop is looking at is broken such as RecordsID 1, 2, 3, 4, 7, 8 the loop stops and it shows an error. This is the code that I have:
Code:
Dim GetEMailAddresses As New ADODB.Recordset
Dim conn As ADODB.Connection
Set conn = CurrentProject.Connection
Dim EMailAddressResult As String
Dim MailID As Integer
Dim x As Integer
For x = 1 To 60
MailID = x
GetEMailAddresses.Open "SELECT MailingEMailAddress FROM TBLProclaimEMailList WHERE MemberID = " & MailID & "", conn
EMailAddressResult = GetEMailAddresses("MailingEMailAddress").Value
GetEMailAddresses.Close
Debug.Print EMailAddressResult
Next x
Can anyone see how to modify this code to enable the search to include or skip the non-existant record?
Hope you can help
Regards
InkyRich
A fool and his money are soon parted - so you might as well send it to me!