hello everyone,
i just want to know how to open multiple text file.. i have a textfile
located at "C:\textlog\..." (the text file name is base on the date i.e.
10012006, 10022006, 10032006 so on)i have a lot of text file and it will
take a lot of time to save it one by one, what i want to do is, i will
use a datepicker component then whe i select a date, the text file in
the "C:\textlog" the in the range of selected date will automatically
read and save is auomaticaly to access...i'm using this code which can
save only one text file only..somebody can modify this to save a
multiple text file

Dim InFile As Integer
Dim InLine As String
Dim Data() As String
Dim Fields As Integer
Dim i As Integer
'Database variables
Dim db As Database

InFile = FreeFile
Open App.Path & "\Data.txt" For Input As #InFile
'If your data files do not have a header of two lines then modify
these lines
'to relect the setup of your own data files
If Not EOF(InFile) Then
'Skip the first two lines since they contain header information
Line Input #InFile, InLine
Line Input #InFile, InLine
End If
'Open the database
Set db = DBEngine.OpenDatabase(App.Path & "\db1.mdb")
'Start the real data processing
While Not EOF(InFile)
Line Input #InFile, InLine
Data() = Split(InLine)
Fields = UBound(Data())
'Process your data as you see fit
'I am simply printing the data to the Immediate window ([CTRL]-G
to see)
' For i = 0 To Fields
' Debug.Print Data(i)
' Next
' Debug.Print "--- End Of Record ---"
'Insert your data into the database
db.Execute "INSERT INTO Table1 (DIR_No, Called_Number, [Date],
[Time], Durtn, Units) " & _
"VALUES ('" & Data(0) & "', " & _
"'" & Data(1) & "', " & _
"DateValue('" & Format(ToDate(Left(Data(2),
10), "dd/mm/yyyy"), "dd mmm yyyy") & "'), " & _
"TimeValue('" & Data(3) & "'), " & _
"TimeValue('00:" & Data(4) & "'), " & _
Data(5) & ")"
Wend
Close #InFile



*** Sent via Developersdex http://www.developersdex.com ***