VBA Run Time Error "-2147417851" (80010105) Automation Error, Server Threw an Exception
Good Morning All,
I have a VBA script in an Access 2003 database that takes a list of user supplied account #s and performs a screen search of a server emulation workstation screen takes an action, then moves onto the next loan (workstation emulator is attachmate MyExtra! 7.11).
The script works fine has been working fine and has been used for thousands of updates.
This week, I am starting to see an intermittent run time error stating "server thew an exception" and debug highlights line "counter = ObjScreen.WaitHostQuiet(20
0) '.010 seconds" (full code attached).
Anyone have any ideas on what is prompting this intermittent error?
Public Function SearchScreen(Item As String) As Boolean
Dim loop_cnt As Integer
Dim wait_rtn As Boolean
Dim counter As Variant
Search_OIA 'Check OIA status before searching for item on screen
Search_OIA 'Check OIA status before searching for item on screen
loop_cnt = 0
wait_rtn = False
Do Until wait_rtn Or loop_cnt > 25
wait_rtn = ObjScreen.WaitForString(Item)
loop_cnt = loop_cnt + 1
counter = ObjScreen.WaitHostQuiet(200) '.010 seconds
If loop_cnt > 25 Then
SearchScreen = False
search_err = True
MsgBox "Alltel system response delay....Unable to locate item (" & Item & ") please re-start program or call programmer!", 16, "Processing Error!"
SearchScreen = True
search_err = False
End If
End Function
Don't use on error resume next yet. We need to get to the bottom of this first. So ...tell me please how do you creat the ObjScreen object.
it has to be done like this :
Dim ObjSystem As Object
Dim ObjSession As Object
Dim ObjScreen As Object
Set ObjSystem = CreateObject("EXTRA.System
")
Set ObjSession = ObjSystem.ActiveSession
Set ObjScreen = ObjSession.Screen
WaitHostQuiet has to work with no problems if u define the objects like this...
Hi deicidedx,
I've posted the public variables below and since I'm restricted to one code snipet
Here is how the session is initialized.
The problem has become intermittent and seems to go away for awhile if the database is closed and restarted and the attachmate session is also closed and restarted (no idea on how often an hour the users are seeing the error).
Thank you all for your help!
Public Function InitializeExtra(strSession
As String) As Boolean
Dim sesscount As Integer
Set ObjSys = CreateObject("EXTRA.system
")
Set ObjSessions = ObjSys.Sessions
sesscount = ObjSessions.Count
ObjSys.Timeoutvalue = 1000 'set system timeout value to 1 sec.
If sesscount = 0 Then
InitializeExtra = False 'No Extra Sessions are running
Exit Function
'find out what session to talk to
Dim counter As Integer
For counter = 1 To sesscount
If ObjSessions.Item(counter).
Name = strSession Then
Set ObjExtraSession = ObjSessions.Item(counter)
Set ObjScreen = ObjExtraSession.Screen
Set ObjOIA_Area = ObjScreen.OIA
InitializeExtra = True
Exit For
InitializeExtra = False
End If
Next counter
End If
End Function
Option Compare Database
Option Explicit
Public intReport As Integer
Public ObjSys As Object
Public ObjScreen As Object
Public ObjSessions As Object
Public ObjExtraSession As Object
Public ObjOIA_Area As Object
Public write_rtn As Boolean
Public scrn_data As String
Public Item As String
Public search_err As Integer
Public strSession As String
Public strClient As String
' Variables From The Input File
Public strqClient As String
Public strLoanNumber As String
Public strRejectReason As String
' PIR1
Public strPIR1Date As String
Public strPIR1OccupancyStatus As String
Public strPIR1PropCondition As String
Public strPIR1OccupancyDescrption As String
Public strReadNewOccStatus As String
Public strReadNewPropCondition As String
Cool thank you for that idea...I'll grab a test box and see if when the error presents it eventually goes away on its own. I wish these blasted errors were more helpful. :)
Happy Holidays!
Deicidedx was able to point out that the problem was not strictly code based and that I'm basically going to have to keep prompting the error until I can deduce what in the target application (the workstation emulator in this case) is causing the problem.
Points awarded because he also provided a workaround until I can nail down the problem.
it has to be done like this :
Dim ObjSystem As Object
Dim ObjSession As Object
Dim ObjScreen As Object
Set ObjSystem = CreateObject("EXTRA.System
Set ObjSession = ObjSystem.ActiveSession
Set ObjScreen = ObjSession.Screen
WaitHostQuiet has to work with no problems if u define the objects like this...
ASKER
I've posted the public variables below and since I'm restricted to one code snipet
Here is how the session is initialized.
The problem has become intermittent and seems to go away for awhile if the database is closed and restarted and the attachmate session is also closed and restarted (no idea on how often an hour the users are seeing the error).
Thank you all for your help!
Public Function InitializeExtra(strSession
Dim sesscount As Integer
Set ObjSys = CreateObject("EXTRA.system
Set ObjSessions = ObjSys.Sessions
sesscount = ObjSessions.Count
ObjSys.Timeoutvalue = 1000 'set system timeout value to 1 sec.
If sesscount = 0 Then
InitializeExtra = False 'No Extra Sessions are running
Exit Function
'find out what session to talk to
Dim counter As Integer
For counter = 1 To sesscount
If ObjSessions.Item(counter).
Set ObjExtraSession = ObjSessions.Item(counter)
Set ObjScreen = ObjExtraSession.Screen
Set ObjOIA_Area = ObjScreen.OIA
InitializeExtra = True
Exit For
InitializeExtra = False
End If
Next counter
End If
End Function
Open in new window
ASKER
Happy Holidays!
ASKER
Points awarded because he also provided a workaround until I can nail down the problem.