It is important to note that you should (reads must) have the JET4 database engine installed on the target
machine.
The key lies in 2 differences from standard ADO Connections
- The use of a path as a database source and a file as a table name in ADO
Set myConn = New
ADODB.Connection
myConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.path
& ";Mode=Share Deny None;Extended Properties=TEXT"
Dim MyRs As New ADODB.Recordset
Set MyRs = New ADODB.Recordset
MyRs.CursorType = adOpenStatic
MyRs.LockType = adLockReadOnly
MyRs.CacheSize = 65000 ' (read up to 65000 records into RAM to avoid hard disk I/O
overhead)
MyRs.Open "select * from mysummaryfile.txt", myConn,
, , adCmdText
....
- The use of a file called schema.ini to determine the structure of the data in the file (pseudotable)
Normally this file is created and defined with the ODBC connection tool.
Example:
[mysummaryfile.txt]
ColNameHeader=False
Format=FixedLength
MaxScanRows=25
CharacterSet=OEM
Col1=Mycolumn1 Char Width 72
Col2=Mycolumn2 Char Width 70
Note: The file must be located in the same path as the file/pseudotable. |