Loop won't add more than one record to database.

Tech-Archive recommends: Fix windows errors by optimizing your registry



I have an array with elements 0 - 5 called mstrDiag . I'm using the
following loop to add non-blank elements to an MS Access table using a
Data Environment.

Dim intIndex As Integer
intIndex = 0
Do
If mstrDiag(intIndex) <> "" Then
With deData.rsDiagnoses
..AddNew
!Diagnosis = mstrDiag(intIndex)
!ptID = mintPNum
..Update
End With
End If
intIndex = intIndex + 1
Loop Until intIndex = 5

As soon as it adds one record, it drops out of the loop and won't add
any more records. I know the array has more than one non-blank element
in it. The same thing happens when using a For/Each/Next loop. Why does
it stop with just one?

I be thankin' ya
Rod

.



Relevant Pages