I have the following code and when I attempt to run it, it doesn't loop properly.
The underlying table from which I am pulling data contains 1000 records. The field length is 20.
The online help hasn't helped me at all and I'm wondering if anyone is seeing anything that stands out as being incorrect?
TIA,
Lisa
************Code*******************
Set rstAccountNumber = dbsCurrent.OpenRecordset("tblAccounts", dbOpenDynaset)
Set rstStrings = dbsCurrent.OpenRecordset("tblStrings", dbOpenDynaset)
rstAccountNumber.MoveLast
LastAcct = rstAccountNumber![AccountNumber]
rstAccountNumber.MoveFirst
FirstAcct = BeginAcct
Do
For i = BeginAcct To LastAcct
CurAcct = rstAccountNumber![AccountNumber]
FDRSess.Screen.SendKeys "BS " & CurAcct & "<Enter>"
Phone = FDRSess.Screen.GetString(4, 67, 4, 78)
FDRSess.Screen.SendKeys "<Home>CIS<Enter>"
NameString = FDRSess.Screen.GetString(2, 1, 2, 80)
Do
For j = 2 To 24
InitialCheck = FDRSess.Screen.GetString(j, 23, 80)
If InitialCheck = "BC *" Then
MemoString = InitialCheck
rstStrings.AddNew
rstStrings![AccountNumber] = CurAcct
rstStrings![NameString] = NameString
rstStrings![MemoLine] = MemoString
rstStrings![Phone] = Phone
rstStrings.Update
End If
Next j
Loop Until j = 2
If CurAcct = LastAcct Then
MsgBox "Complete"
End If
Exit Do
Next i
Loop Until i = LastAcct
End Function
The underlying table from which I am pulling data contains 1000 records. The field length is 20.
The online help hasn't helped me at all and I'm wondering if anyone is seeing anything that stands out as being incorrect?
TIA,
Lisa
************Code*******************
Set rstAccountNumber = dbsCurrent.OpenRecordset("tblAccounts", dbOpenDynaset)
Set rstStrings = dbsCurrent.OpenRecordset("tblStrings", dbOpenDynaset)
rstAccountNumber.MoveLast
LastAcct = rstAccountNumber![AccountNumber]
rstAccountNumber.MoveFirst
FirstAcct = BeginAcct
Do
For i = BeginAcct To LastAcct
CurAcct = rstAccountNumber![AccountNumber]
FDRSess.Screen.SendKeys "BS " & CurAcct & "<Enter>"
Phone = FDRSess.Screen.GetString(4, 67, 4, 78)
FDRSess.Screen.SendKeys "<Home>CIS<Enter>"
NameString = FDRSess.Screen.GetString(2, 1, 2, 80)
Do
For j = 2 To 24
InitialCheck = FDRSess.Screen.GetString(j, 23, 80)
If InitialCheck = "BC *" Then
MemoString = InitialCheck
rstStrings.AddNew
rstStrings![AccountNumber] = CurAcct
rstStrings![NameString] = NameString
rstStrings![MemoLine] = MemoString
rstStrings![Phone] = Phone
rstStrings.Update
End If
Next j
Loop Until j = 2
If CurAcct = LastAcct Then
MsgBox "Complete"
End If
Exit Do
Next i
Loop Until i = LastAcct
End Function