This must be something stupid

Results 1 to 2 of 2

Thread: This must be something stupid

  1. #1
    Join Date
    Dec 1969

    Default This must be something stupid

    I&#039;m trying to use a Do While to loop data entry into a database. The data is being entered correctly but the loop never stops, By the time I can stop it 65,000 entries are created. To check the value of the variables I included them in the post to the database. Please review this code and let me know if you see anything.<BR><BR>_________________________________ ________________________<BR><BR>If Request.Form("btnAdd") = "Add Event" Then<BR><BR>Dim EnterDay<BR>Dim StopDay<BR><BR> EnterDay = Request.Form("selDay")<BR> StopDay = Request.Form("selEndDay")<BR><BR> Do While EnterDay &#060;= StopDay<BR> objRecordset.AddNew<BR><BR> &#039;-- Add records to database from form --<BR><BR> objRecordset.Fields("Subject") = Request.Form("txtSubject")<BR> objRecordset.Fields("Message") = Request.Form("Message") & StopDay<BR> objRecordset.Fields("Day") = EnterDay<BR> objRecordset.Fields("Month") = Request.Form("selMonth")<BR> objRecordset.Fields("Year") = Request.Form("selYear")<BR> objRecordset.Fields("AddedBy") = Request.Form("txtAddedBy")<BR> objRecordset.Fields("DateAdded") = Now()<BR> objRecordset.Fields("IP") = Request.ServerVariables("REMOTE_HOST")<BR><BR> objRecordset.Update<BR> EnterDay = EnterDay + 1<BR> loop<BR> Added = "True"<BR><BR>End If<BR>

  2. #2
    Join Date
    Dec 1969

    Default Stupid, but easily done.

    You need rs.Movenext to stop the loop never hitting EOF.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts