Philip,
I'm sorry I wasn't clear.
Take the sample code I gave you in my first
reponse and change it to this:
Private Sub ProcessFile(strInputFileName as String)
Dim intInputFileHandle As Integer
Dim intHeadFileHandle As Integer
Dim intDetailFileHandle As Integer
Dim strTempInput As String
Dim arrTempArray As Variant
intInputFileHandle = FreeFile
Open strInputFileName For Input As #intInputFileHandle
intHeadFileHandle = FreeFile
Open "c:\head.txt" For Append As #intHeadFileHandle
intDetailFileHandle = FreeFile
Open "c:\detailfilehandle.txt" For Append As #intDetailFileHandle
Do Until EOF(intInputFileHandle)
Line Input #intInputFileHandle, strTempInput
arrTempArray = Split(strTempInput, ",")
Select Case UCase(arrTempArray(0))
Case "HEAD"
Print #intHeadFileHandle, Mid$(strTempInput, 6)
Case "DETL"
Print #intHeadFileHandle, Mid$(strTempInput, 6)
Case Else
MsgBox "Unrecognized Line Type"
End Select
Loop
Close #intInputFileHandle
Close #intHeadFileHandle
Close #intDetailFileHandle
End Sub
Basically I moved all the file handling
stuff into a separate Sub routine.
Here is some example code on how to create,
manipulate, and output data from a recordset
that has no database in the background.
Private Sub RecordsetExample()
Dim A As ADODB.Recordset
Set A = New ADODB.Recordset
A.Fields.Append "MyDate", adDate
A.Fields.Append "OutString", adVarChar, 255
A.Open
A.AddNew
A.Fields("MyDate").Value = "4/5/2000"
A.Fields("OutString").Value = "D,4/5/2000,ETC,ETC,ETC"
A.Update
A.AddNew
A.Fields("MyDate").Value = "12/5/1999"
A.Fields("OutString").Value = "F,12/5/1999,ETC,ETC,ETC"
A.Update
A.Sort = "MyDate"
A.MoveFirst
Debug.Print A.Fields("outstring").Value
A.MoveNext
Debug.Print A.Fields("Outstring").Value
A.Close
Set A = Nothing
End Sub
I'm a little short on time today or else I would modify
the code myself, but at least this should get you
started on the right track. Good luck on your project!
Cardyin
--------------------------------------
Cardyin Kim
C/S & Web Development Analyst
Information Services
San Antonio Community Hospital
ckim@s... (xxx)xxx-xxxx
--------------------------------------