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

Remove duplicate value

P: 20
Hello everbody,

Please help me to remove the duplicate value. I have this code

Do until objRSEmail.eof

tgroup = objRSEmail("tEmailName")&"@city.com;"&tgroup

objRSEmail.MoveNext
Loop

the output of this is
john@city.com;john@city.com;smith@city.com

i want to have output like this(to remove the second occurence of same email address)
john@city.com;smith@city.com.


Thanks
Dec 3 '07 #1
Share this Question
Share on Google+
5 Replies


codegecko
Expert 100+
P: 533
Hy lyme,

Try:
Expand|Select|Wrap|Line Numbers
  1. For I = 1 To objRSEmail.RecordCount   
  2.          tgroup = tgroup & objRSEmail("tEmailName") & "@city.com;"
  3.     objRSEmail.MoveNext
  4. Next
  5.  
medicineworker
Dec 3 '07 #2

shweta123
Expert 100+
P: 692
Hi,

It is taking duplicate values for emailId because may be recordset objRSEmail is containing duplicate values. So you can write sql query that is required to fill up the recordset like this

Sql = "Select distinct tEmailName from tablename"


Hello everbody,

Please help me to remove the duplicate value. I have this code

Do until objRSEmail.eof

tgroup = objRSEmail("tEmailName")&"@city.com;"&tgroup

objRSEmail.MoveNext
Loop

the output of this is
john@city.com;john@city.com;smith@city.com

i want to have output like this(to remove the second occurence of same email address)
john@city.com;smith@city.com.


Thanks
Dec 3 '07 #3

P: 20
The scenario of this is: John has 2 request and Smith has one request, once the request has been approved, the program will send email notification to the requestor.

in my code:
Do until objRSEmail.eof
tgroup = objRSEmail("tEmailName")&"@imiphil.com;"&tgroup

objRSEmail.MoveNext
Loop

In a tgroup variable, the system will check if there's already John@City.com then it will add the next email Smith@City.com. so the output will be John@City.com;Smith@City.com
not
John@City.com;John@City.com;Smith@City.com

THanks again
Dec 4 '07 #4

shweta123
Expert 100+
P: 692
Hi ,

Here you can check for duplicate values for EmailName using :

Do until objRSEmail.eof

If instr(tgroup ,objRSEmail("tEmailName"))=0 then
tgroup = objRSEmail("tEmailName")&"@City.com;"&tgroup
end if
objRSEmail.MoveNext
Loop



The scenario of this is: John has 2 request and Smith has one request, once the request has been approved, the program will send email notification to the requestor.

in my code:
Do until objRSEmail.eof
tgroup = objRSEmail("tEmailName")&"@imiphil.com;"&tgroup

objRSEmail.MoveNext
Loop

In a tgroup variable, the system will check if there's already John@City.com then it will add the next email Smith@City.com. so the output will be John@City.com;Smith@City.com
not
John@City.com;John@City.com;Smith@City.com

THanks again
Dec 4 '07 #5

codegecko
Expert 100+
P: 533
HI there,

Or you could just use the SELECT DISTINCT to select only unique email names?

medicineworker
Dec 4 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.