473,326 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Looping Through a Recordset

I am trying to loop through a recordset and send an email to each
Record found. at the moment all records are being sent i.e.

email 1 sends 1 record
email 2 send 2 records
email 3 sends 3 records etc. etc.

is there a way to just send 1 record to each email address my code is
listed below

<%
dNow = date()
Response.Write "Todays Date " & dNow & "<br>" & "<br>"
Set aRS = Server.CreateObject ("ADODB.Recordset")
aSQL = "SELECT * FROM Contracts WHERE ReNegDate <= #"&dNow&"# "
aRS.Open aSQL, MM_purCon_STRING

if not aRS.eof then
while not aRS.eof

conName = aRS("ConName")
renewDate = aRS("ReNegDate")
aEmail = aRS("EmailAlert")

strBody = strBody & "Email Alert Sent " & now () & vbCrlf
strBody = strBody & "Email Alert For " & conName & vbCrlf
strBody = strBody & "Renewal Date " & renewDate & vbCrlf & vbCrlf
strBody = strBody & "Login to System" & vbCrlf
strBody = strBody & "http://hsboardwalk/purConSystem" & vbCrlf &
vbCrlf

Set objMail = Server.CreateObject ("CDONTS.NewMail")

objMail.To = aEmail
objMail.From = "a@a.co.uk"
objMail.Subject = "Purchase Contract System Renewal Alert"
objMail.Body = strBody

objMail.Send
Set objMail = Nothing

empty aRS

aRS.MoveNext
wend
end if

aRS.Close
Set aRS = Nothing
%>
Nov 21 '05 #1
3 1688
Mans,

Are you sure you want to use AdoDb. You can use it however I see not any
reason in your situation in VBNet. You can only get installation problems
and more of those things from that and not 1 positive result..

Cor
Nov 21 '05 #2
(it doesn't look like asp.net at all - looks like classic ASP to me...)

"Cor Ligthert" wrote:
Mans,

Are you sure you want to use AdoDb. You can use it however I see not any
reason in your situation in VBNet. You can only get installation problems
and more of those things from that and not 1 positive result..

Cor

Nov 21 '05 #3
Bonj,
(it doesn't look like asp.net at all - looks like classic ASP to me...)


When I look to it complete, me too, however an ASPX page takes a lot, so I
don't say that.

Cor
Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Roy Adams | last post by:
Hi posting again because no answer to previous.. tring to loop through a recordset and update a record, thing is it only updates the first record in the table rather than searching through the...
7
by: Lauren Quantrell | last post by:
I have a table with three columns. One of the columns contains text output data nvarchar(500), one of them contains a filename nvarchar(50), one of the columns is a bit to record if it has been...
8
by: RC | last post by:
I have a table that lists many box numbers. Each box number has a Pallet Number (indicating which pallet the box is in). When the Pallets are loaded into a shipping Container I need to update the...
1
by: David | last post by:
Hi, I have a continuous form based on a query. Lets say the form displays 6 records. I also have a button against each record which sets a field to Y or N for each record. I am trying to...
1
by: @ndy | last post by:
Hellow programmers, does anybody has any suggestions for the next problem? I'm looping a recordset and during the loop it allso calculate some things. Now I want display a POPUP FORM with...
11
by: Dacuna | last post by:
Is it possible to use a recursive function to loop through a recordset faster? I have a table that I need to edit its contents after doing some calculation. The table has one field has an RawData...
11
by: Jim Whitaker | last post by:
Expand full for viewing... I have a parent/child table. The basic setup is as follows: The parent table is called load sheet. It has fields such as Tripno, carrier, loaddate, etc. The child...
1
by: Ryan | last post by:
Hello. I was hoping that someone may be able to assist with an issue that I am experiencing. I have created an Access DB which imports an Excel File with a particular layout and field naming. ...
1
by: pds79 | last post by:
Hi everyone, I'm a newbie to the forum. I have an issue and was hoping to get some assistance/ideas: Im trying to read a XML file into two record sets. I can acheive looping through the...
10
by: akselo | last post by:
Hi folks, I am working on a routine that will select a sample of parcels from a table. Each parcel belongs to a census tract, and depending on which tract, a certain calculation is applied. The...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.