I am having difficulties extracting information from another application to load in my database. I have one table (tblAccounts) that stores account numbers and another table set up to receive the account number and the additional information I'm screen scraping from our system. I am using a Do... Loop to a) scroll through the list of accounts and b) to scroll through multiple lines on each account.
My first issue is that it doesn't seem to pull account numbers correctly and the second issue is that it's not saving any data.
Can anyone see what my problem might be?
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
My first issue is that it doesn't seem to pull account numbers correctly and the second issue is that it's not saving any data.
Can anyone see what my problem might be?
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