PASSPORT Knowledge Base
Macros

Date Published: December 10, 2008
Date Updated: March 23, 2009

Title

Capture Data from a PASSPORT Session Then Import Into MS Access Database

Product

PASSPORT PC to Host, PASSPORT Web to Host

Emulation Types

TN3270, TN5250, VT, SCO ANSI, Wyse 60

Issue

How can I capture fields from a current screen on the session and add them to a Microsoft Access Database table?

Solution

You can write a PASSPORT macro to communicate from the session to the Access database using the following sample code below:
 

Sub ZMain()
 

Const adOpenStatic = 3

const adLockOptimistic = 3

 

Set objConnection = CreateObject("ADODB.Connection")

Set objRecordset = CreateObject("ADODB.Recordset")

objConnection.Provider = "Microsoft.Jet.OLEDB.4.0"

objConnection.Open "\\network path here\MS ACCESS DATABASE.mdb"

 

objRecordset.Open "Select * from tblInv",objConnection,adOpenStatic,adLockOptimistic

 

objRecordset.AddNew

ObjRecordset("Vend") = "getstring here"

objRecordset.Update
 

End sub

More Information

Keywords

communicate, Microsoft Access, database, capture, fields, screen, session, write, record