Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access - Attachmate Location

Status
Not open for further replies.

gouldie64

Technical User
Mar 29, 2017
3
US
I have a basic Access/Attachmate question. How does Access know where to find the Attachmate Session?

I had a "super-user" who created some screen scrape forms in Access. After he left us the IT folks put a new image on our PCs.

In the old image our mainframe session was here: C:\Program Files\Attachmate\EXTRA!\Sessions

Now its here: C:\Program Files (x86)\Attachmate\EXTRA!\Sessions

Access is still trying to find the session at the old location. I cannot find anywhere in the code where we tell Access to look in "Program Files (x86)" instead of "Program Files". We patched it by recreating the "Program Files" folder and copying the session over there, but it's driving me crazy that I can't find it in the code anywhere.
 
Plz post the code that Sets the System and Session objects. Use Edit/Find on the entire project.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
You might get better results in Forum702.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Here is the part of the code that connects to the mainframe. Everything after this has to do with our unique process (specific fields to scrape, what table to use, etc...)

Thanks,

Helen




Option Compare Database
Option Explicit

Private Sub Command4_Click()
'Declare variables
Dim dbsCurrent As DAO.DATABASE
Dim rstReviews As DAO.Recordset
Dim g_HostSettleTime%
Dim Sessions As Object
Dim System As Object
Dim SessName As String
Dim rstEdits As DAO.Recordset

Set dbsCurrent = CurrentDb()

'OpenRecordset method is the basic method of creating a
'Recordset Object. dbOpenTable is the type of Recordset to create. dbOpenDynaset is used for queries
Set rstReviews = dbsCurrent.OpenRecordset("test_table", DB_OPEN_DYNASET)


'With the information from the table acquired, now go to host session
Set System = CreateObject("EXTRA.System") ' Gets the system object
If (System Is Nothing) Then
MsgBox "Could not create the EXTRA System object. Stopping macro playback."
Stop
End If

Set Sessions = System.Sessions

If (Sessions Is Nothing) Then
MsgBox "Could not create the Sessions collection object. Stopping macro playback."
Stop
End If

' Set the default wait timeout value
g_HostSettleTime% = 0 ' milliseconds
Dim OldSystemTimeout
OldSystemTimeout = System.TimeoutValue
If (g_HostSettleTime% > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime%
End If

' Get the necessary Session Object
' This is an example of requiring a connection to a specific host session
Dim Sess0 As Object
Dim SessName0
SessName0 = "DSD Mainframe.edp"

On Error Resume Next ' In Case session next statement fails.
Err = 0
Set Sess0 = Sessions.Item(SessName0)
If Err Then
Err = MsgBox(SessName0 + " is not currently open. Open it?", 1)
If 1 = Err Then
Err = 0
Set Sess0 = Sessions.Open(SessName0)
If Err Then
MsgBox ("Failed to open " + SessName0 + ". Stopping playback")
Stop
End If
ElseIf 2 = Err Then
Stop
Else
MsgBox ("Failed to open " + SessName0 + ". Stopping playback")
Stop
End If
End If

'If you just wanted to connect to an active session on the desktop, instead
'of the above lines of code you could use
'Set Sess0 = System.ActiveSession

'make sure the session is visible
If Not Sess0.Visible Then Sess0.Visible = True
Sess0.Screen.WaitHostQuiet (g_HostSettleTime%)
 
This is my code for assigning the Session object in Attachmate Extra...
Code:
'
    If oSystem.Sessions.Count = 0 Then
        Set oSess = oSystem.Sessions.Open("C:\Program Files\E!PC\Sessions\Mainframe.edp")
    Else
        Set oSess = oSystem.ActiveSession
    End If

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top