title: VBA Access - Checking recordset on subform load
body: <p>I have an <code>On_Load()</code> sub which checks the records present on a subform, record by record. For example, if the subform loads with 12 records on it, I need the sub to start with the first record, run a <code>DCount</code> (it checks if the job number appears on a different table), then move to the next record, and check that one, etc until it reaches the last record. Here's my code at the moment:</p>
  
  <pre><code>Set rst = Me.RecordsetClone
      On Error Resume Next
      rst.MoveFirst
  'Put code to check keyword schedule here. First get job no
          Do Until Me.Specific_Job_No.Value = "00"
              strSpec = Format(Me.Specific_Job_No.Value, "00")
              strJob = Left(Me.Parent.JobRef.Value, 18) + strSpec
  'Then check if that job no is in slot 1, then 2, etc
              If DCount("*", "tblKeywordsSchedule", "[Slot1] Like ""*" &amp; strJob &amp; "*""") &gt; 0 Then
                  Me![Added to Schedule] = True
                  Me![Added to Schedule].Locked = True
              Else
                  Me![Added to Schedule] = False
                  Me![Added to Schedule].Locked = False
              End If
  'Then go to next record
      rst.MoveNext
          Loop
  </code></pre>
  
  <p>My problem is, it gets stuck on <code>rst.MoveNext</code> and just keeps checking the first record over and over again. What am I doing wrong?</p>