1. I want to read a text file into a db using a schema.ini file.
2. My position-delimited text file has the exact same format as a table in my db. I have made a valid schema.ini file that also has the exact same format.
3. I found a vba function at support.microsoft.com. If you have a valid schema.ini file, it will read the text file into a recordset. The code works great!
4. Here is my question: How do I actually import the recordset?!? I have searched for a method like "rs.import", but I can't find anything like that. I do NOT want to import it one row at a time. The file is 125mb.
5. If your answer requires me to reference anything special, please mention the reference.
Here is a code sample:
'from Function TestSchema()
Dim db As Database, rs As Recordset
Set db = OpenDatabase("c:\", False, _
False, "TEXT;Database=c:\;table=sales.txt")
Set rs = db.OpenRecordset("sales.txt")
Debug.Print rs(0).Value
rs.MoveLast
Debug.Print "Record count= " & rs.RecordCount
rs.Close
End Function
2. My position-delimited text file has the exact same format as a table in my db. I have made a valid schema.ini file that also has the exact same format.
3. I found a vba function at support.microsoft.com. If you have a valid schema.ini file, it will read the text file into a recordset. The code works great!
4. Here is my question: How do I actually import the recordset?!? I have searched for a method like "rs.import", but I can't find anything like that. I do NOT want to import it one row at a time. The file is 125mb.
5. If your answer requires me to reference anything special, please mention the reference.
Here is a code sample:
'from Function TestSchema()
Dim db As Database, rs As Recordset
Set db = OpenDatabase("c:\", False, _
False, "TEXT;Database=c:\;table=sales.txt")
Set rs = db.OpenRecordset("sales.txt")
Debug.Print rs(0).Value
rs.MoveLast
Debug.Print "Record count= " & rs.RecordCount
rs.Close
End Function