Sorry for the cross post.
What is wrong with this code?--ado recordset to populate a collection--see
reason below
Dim myCol2 As New Collection
On Error Resume Next
Do While Not rs.EOF
myCol2.Add rs!Email, rs!Email
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
oConn.Close
Set oConn = Nothing
MsgBox myCol2.Count
For Each Item In myCol2
Set rcp = ml.Recipients.Add(myCol2(Item))
rcp.Type = olBCC
Next
-------The msgbox shows the correct count but I can not get the string data
from each item. What am I missing?? I have tried a counting for x = 1 to
myCol2.count and fox x=mycol2.count to 1 step -1... I can not figure out
what I am overlooking. I believe the collection object is being populated
correctly. I think it's something around my on error resume next line of
code. I am trying to get email addresses from my db. That works fine. I
want to loop through those records and add the email address as the item
and the key values to the collection object. This will prevent more than one
of the same email address. I then want to loop through the collection and
add each item to the recipients collection of an outlook.mailitem. I can
make everything work if I skip the collection, but this lets the same email
address be added any number of times. Thanks everybody.
~ck