T
TeeSee
Could someone please tell me why this loop doesn't get past the first
record. Even after the .MoveNext the second record is not accessed. I
haven't done anything with the outut (strC) as yet.
Private Sub Form_Load()
Dim rst As DAO.Recordset
Dim db As DAO.Database
Dim intCount As Integer
Dim strA As String
Dim strB As String
Dim strC As String
Dim intI As Integer
Set db = CurrentDb()
Set rst = db.OpenRecordset("tblDescriptions")
rst.MoveLast
rst.MoveFirst
With rst
If rst.RecordCount > 0 Then
.MoveFirst
Do
Debug.Print .RecordCount
Debug.Print descID ' pk of underlying table
strA = Me.txtDescription.Value
Debug.Print strA
For intI = 1 To Len(strA)
strB = Mid(strA, intI, 1)
If strB Like "[A-Z,a-z,0-9, ]" Then
strC = strC & strB
End If
Next intI
Debug.Print strC
.MoveNext
Loop Until .EOF
End If
.Close
Set rst = Nothing
End With
End Sub
Thank you as always.
record. Even after the .MoveNext the second record is not accessed. I
haven't done anything with the outut (strC) as yet.
Private Sub Form_Load()
Dim rst As DAO.Recordset
Dim db As DAO.Database
Dim intCount As Integer
Dim strA As String
Dim strB As String
Dim strC As String
Dim intI As Integer
Set db = CurrentDb()
Set rst = db.OpenRecordset("tblDescriptions")
rst.MoveLast
rst.MoveFirst
With rst
If rst.RecordCount > 0 Then
.MoveFirst
Do
Debug.Print .RecordCount
Debug.Print descID ' pk of underlying table
strA = Me.txtDescription.Value
Debug.Print strA
For intI = 1 To Len(strA)
strB = Mid(strA, intI, 1)
If strB Like "[A-Z,a-z,0-9, ]" Then
strC = strC & strB
End If
Next intI
Debug.Print strC
.MoveNext
Loop Until .EOF
End If
.Close
Set rst = Nothing
End With
End Sub
Thank you as always.