By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,164 Members | 1,019 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,164 IT Pros & Developers. It's quick & easy.

Checking for duplicate data in table

P: n/a
Hi All,

Hoping someone can help with this one.

I am opening a table and looping through the RecordSource (RcSr) of !
Email

I am trying to add each email address to the string (strEmail) for use
in sending to outlook.

Within each loop i am looping through another instance of the same
record source (RcSr2)

This works fine EXCEPT if the record is duplicated then it does not
add it at all.

My brain is continually going around this loop so i am not a little
confused.

Any help would be greatly appreciated.

Thanks./
'''''''''''CODE

If RcSr.RecordCount <0 Then

Do While Not RcSr.EOF

Duplicate = 0
strTest = Nz(rsSrc!Email)

If RcSr2.RecordCount <0 Then
Do While Not RcSr2.EOF
strTest2 = Nz(rsSrc2!Email)
If strTest = strTest2 Then
Duplicate = Duplicate + 1
End If
RcSr2.MoveNext
Loop
End If
Set RcSr2= CurrentDb.OpenRecordset(sSQL2)
If Duplicate < 2 Then
If strEmail = "" Then
strEmail = RcSr!Email & ";"
Else
strEmail = strEmail & RcSr!Email & ";"
End If
End If
NextContact:
RcSr.MoveNext
Loop
End If

'''''End CODE

Aug 10 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.