How to load multiple textfile
i have a big problem with my project, my project is time and attendance base on the textlog generated by the
BIOMETRIC DEVICE in which is the basis of the attendance of the employees..
the textlog is located at "C:\textlog\..." the exact filename of the textfile is 10012006, 10022006, 10032006,
10042006, 10052006 and so on..that is base on the date which the employees swipe their ID as their attendance... the textfile
are so numerous that i can not read the files one by one... so i plan to read it in this way
i will use a datepicker then when i select a date i.e. oct 1 to 3..the textfile that has a filename range to the
selected date will read then save it to the database...i already to how to save textfile to database..
'+++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++'
sFile = txtFile.Text
inFile = FreeFile
Open sFile For Input As #inFile
Set conn = New ADODB.Connection
conn.Open "DRIVER={MySQL ODBC 3.51 Driver};" & "SERVER=localhost;" & " DATABASE=time_and_attendance;" &
"UID=root;PWD=admin; OPTION=3"
While Not EOF(inFile)
Line Input #inFile, InLine
If InStr(InLine, "Event:Access") > 0 Then
data() = Split(InLine)
fields = UBound(data())
'On Error GoTo badfile
Set rs = New ADODB.Recordset
squery = "": squery = ("Select * from tblattendance where Date='" & data(0) & "' AND CardNumber = '" & data(5) & "'")
Call ExecuteCommand
If rs.EOF Then ' NO DATA RETURNED
conn.Execute "INSERT INTO tblattendance (Date, TimeIn, Event, CardNumber) " & _
"VALUES ('" & data(0) & "', " & _
"'" & Left(data(1), 8) & "', " & _
"'" & Mid(data(2), 7) & "', " & _
"'" & Card(data(5)) & "')"
++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++
all i wanted is to read multiple textfile to solved by problem...thanks....
|