Results 1 to 2 of 2
  1. #1
    nmlinac is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2013

    Loop Not Progressing Through Recordset

    Hi all,

    I'm trying to run through a set of about 7000 records to calculate then store a piece of data but I can't seem to actually move through the records. Everything works absolutely perfectly for one record at a time, but then never moves on to the next record. This should be simple right? Thanks for any help

    Private Sub cmdWDIH_Click()
    Dim db As DAO.Database
    Dim mainrs As DAO.Recordset
    Set db = CurrentDb
    Set mainrs = db.OpenRecordset("MainQuery")
    Do Until mainrs.EOF = True
        If (Not IsNull(txtSumShipDate.Value) And Not IsNull(txtSumPromiseDate.Value)) Then
                Me!WorkDaysInHouse = CalcWorkdays([ReceiveDate], [ShipDate])
                txtSumShipDays.Value = WorkDaysInHouse
                If (WorkDaysInHouse <= 2) Then
                    txtSumOnTime.Value = "Yes"
                    txtSumOnTime.Value = "No"
                End If
                Me!ShipFY = getFY([ShipDate])
                Me!ShipPeriod = getPeriod([ShipDate])
        End If
    MsgBox "Finished"
    End Sub

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Nevada, USA
    You aren't using the recordset, which would look like:


    Further, if you are writing values to the form, you'll just end up with the last one.
    Paul (wino moderator)
    MS Access MVP 2007-2019

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Recordset loop & change values (kinda...)
    By opopanax666 in forum Programming
    Replies: 4
    Last Post: 05-03-2012, 04:26 AM
  2. Replies: 2
    Last Post: 03-08-2012, 12:59 PM
  3. Double loop recordset
    By silverspr in forum Programming
    Replies: 7
    Last Post: 03-07-2012, 01:43 PM
  4. Loop through recordset
    By eliedebs in forum Programming
    Replies: 1
    Last Post: 01-11-2012, 12:26 AM
  5. Bulk Email / Loop through recordset
    By smikkelsen in forum Forms
    Replies: 4
    Last Post: 07-12-2010, 06:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Other Forums: Microsoft Office Forums - Senior Forums