Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Another problem with CDONTS & a Loop

Status
Not open for further replies.

Rexolio

Technical User
Aug 29, 2001
230
Boy, I just can't get a break on this particular subject!! First there was the stupid quotation mark issue. But now I've gotten 2 different users emailing me about an error message they've gotten. Doesn't seem to happen all the time:

error '80070020'
The process cannot access the file because it is being used by another
process.

/members/sendemail.asp, line 167

Both error messages received were the same, with the exception of the line number, which was 164 on the other. Here is the code I'm using. I've indicate lines 167 and 164. It appears that it may be talking about the myMail function, but I'm not sure. Any boyd with suggestions on this, how to fix it or perhaps make it better is greatly appreciated:

<%
SQL=&quot;SELECT * FROM tblMembers WHERE Status = 'Subscribe' ORDER BY Name&quot;
set Listings=Conn.execute(SQL)

do while not Listings.eof

Dim myMail
Set myMail = Server.CreateObject(&quot;CDONTS.NewMail&quot;)

if Listings(&quot;Email&quot;) <> &quot; &quot; then
strEmail = Listings(&quot;Email&quot;)
strName = Listings(&quot;Name&quot;)

if strGreet = &quot;None&quot; then
myMail.Send strSndEmail, strEmail, strSubj, strMsg & vbcrlf & vbcrlf & &quot;TO UNSUBSCRIBE: &quot; & vbcrlf & &quot; & Listings(&quot;NameID&quot;)
end if
if strGreet = &quot;Congratulations&quot; then
myMail.Send strSndEmail, strEmail, strSubj, strGreet & &quot; &quot; & strName & &quot;!&quot; & vbcrlf & vbcrlf & strMsg & vbcrlf & vbcrlf & &quot;TO UNSUBSCRIBE: &quot; & vbcrlf & &quot; & Listings(&quot;NameID&quot;)
^ LINE 164 ABOVE ^
end if
if strGreet = &quot;Dear&quot; then
myMail.Send strSndEmail, strEmail, strSubj, strGreet & &quot; &quot; & strName & &quot;,&quot; & vbcrlf & vbcrlf & strMsg & vbcrlf & vbcrlf & &quot;TO UNSUBSCRIBE: &quot; & vbcrlf & &quot; & Listings(&quot;NameID&quot;)
^ LINE 167 ABOVE ^
end if
if strGreet = &quot;NameOnly&quot; then
myMail.Send strSndEmail, strEmail, strSubj, strName & &quot;,&quot; & vbcrlf & vbcrlf & strMsg & vbcrlf & vbcrlf & &quot;TO UNSUBSCRIBE: &quot; & vbcrlf & &quot; & Listings(&quot;NameID&quot;)
end if

end if

Set myMail = Nothing

Listings.movenext
loop
Listings.close

%>

Thanks in advance!
 
your code gets messed up if you don't do this: [ the word &quot;code&quot; ] and at the end of code put [/ the word &quot;code&quot; ] so your code doesnt mess up..
 
I'm a bonehead!

Code:
<%
SQL=&quot;SELECT * FROM tblMembers WHERE Status = 'Subscribe' ORDER BY Name&quot;
set Listings=Conn.execute(SQL)

do while not Listings.eof

Dim myMail
Set myMail = Server.CreateObject(&quot;CDONTS.NewMail&quot;)

if Listings(&quot;Email&quot;) <> &quot; &quot; then
    strEmail = Listings(&quot;Email&quot;)
    strName = Listings(&quot;Name&quot;)

    if strGreet = &quot;None&quot; then
        myMail.Send strSndEmail, strEmail, strSubj, strMsg & vbcrlf & vbcrlf & &quot;TO UNSUBSCRIBE: &quot; & vbcrlf & &quot;[URL unfurl="true"]http://mysite.com/remove.asp?NID=&quot;[/URL] & Listings(&quot;NameID&quot;)
    end if
    if strGreet = &quot;Congratulations&quot; then
        myMail.Send strSndEmail, strEmail, strSubj, strGreet & &quot; &quot; & strName & &quot;!&quot; & vbcrlf & vbcrlf & strMsg & vbcrlf & vbcrlf & &quot;TO UNSUBSCRIBE: &quot; & vbcrlf & &quot;[URL unfurl="true"]http://mysite.com/remove.asp?NID=&quot;[/URL] & Listings(&quot;NameID&quot;)
        ^ LINE 164 ABOVE ^
    end if
    if strGreet = &quot;Dear&quot; then
        myMail.Send strSndEmail, strEmail, strSubj, strGreet & &quot; &quot; & strName & &quot;,&quot; & vbcrlf & vbcrlf & strMsg & vbcrlf & vbcrlf & &quot;TO UNSUBSCRIBE: &quot; & vbcrlf & &quot;[URL unfurl="true"]http://mysite.com/remove.asp?NID=&quot;[/URL] & Listings(&quot;NameID&quot;)
        ^ LINE 167 ABOVE ^
    end if
    if strGreet = &quot;NameOnly&quot; then
        myMail.Send strSndEmail, strEmail, strSubj, strName & &quot;,&quot; & vbcrlf & vbcrlf & strMsg & vbcrlf & vbcrlf & &quot;TO UNSUBSCRIBE: &quot; & vbcrlf & &quot;[URL unfurl="true"]http://mysite.com/remove.asp?NID=&quot;[/URL] & Listings(&quot;NameID&quot;)
    end if

end if

Set myMail = Nothing

Listings.movenext 
loop
Listings.close

%>
 
try posting it again, im just getting into CDNOTS, I can't even geting something to mail on my system yet. -sigh-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top