2005/11/09 18:32:11, Event:Access, Door:entry, Card No.:2727, Description:266:55748
Date time event door card no. description
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2005/11/09 18:32:11, Event:Access, Door:entry, Card No.:2727, Description:266:55748
2005/11/09 18:32:13, Event:Access, Door:entry, Card No.:2345, Description:266:55732
2006/01/11 14:07:02, Event:Cover Removed Return to Normal, Door:5
2006/01/11 14:07:02, Event:Cover Removed Alarm, Door:5
2005/11/09 18:33:58, Event:Card No. Error, Door:entry, Description:266:51792
2006/01/11 14:07:02, Event:Cover Removed Return to Normal, Door:5
2006/01/24 17:31:27, Eventownload Success!
2006/01/11 14:07:02, Event:Cover Removed Alarm, Door:5
2005/11/09 18:32:21, Event:Access, Door:entry, Card No.:2727, Description:266:55748
2006/01/24 17:31:27, Eventownload Success!
2005/11/09 18:33:58, Event:Card No. Error, Door:entry, Description:266:51792
2006/01/11 14:07:02, Event:Cover Removed Return to Normal, Door:5
2006/01/11 14:07:02, Event:Cover Removed Alarm, Door:5
2005/11/09 18:34:00, Event:Card No. Error, Door:entry, Description:266:51792
2006/01/24 17:31:27, Eventownload Success!
2005/11/09 18:33:20, Event:Card No. Error, Door:entry, Description:266:51792
2005/11/09 18:32:36, Event:Access, Door:entry, Card No.:2727, Description:266:55748
2005/11/09 18:32:46, Event:Access, Door:entry, Card No.:2727, Description:266:55748
2005/11/09 18:32:54, Event:Card No. Error, Door:entry, Description:266:51792
2005/11/09 18:33:42, Event:Card No. Error, Door:entry, Description:266:51792
2005/11/09 18:34:36, Event:Card No. Error, Door:entry, Description:266:51792
hello everyone... can you please help me with my problem, i have a project time and attendance system using a reader which the reader creates a textlog. want i want to do is to save only the row that have a format above, and those row that mismatch the format discard it.. i already know how to save it in database, i just want to validate the saving..hope you can help me
Dim inFile As Integer
Dim InLine As String
Dim data() As String
Dim fields As Integer
Dim sFile As String
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
data() = Split(InLine)
fields = UBound(data())
On Error GoTo badfile
conn.Execute "INSERT INTO tblattendance (Date, TimeIn, Event, CardNumber, Description) " & _
"VALUES ('" & data(0) & "', " & _
"' " & Left(data(1), 8) & "', " & _
"' " & Mid(data(2), 7) & "', " & _
"' " & Card(data(5)) & "', " & _
"' " & data(6) & "')"
Wend
MsgBox "Record successfully saved ", vbInformation + vbOKOnly, "Record Saved"
Unload Me
Me.Show
Close #inFile
Exit Sub
badfile:
MsgBox "Error type of file ", vbCritical + vbOKOnly, "Error"
or if somebody help me on how to load the textfile in listbox, same validation ingnore the data that not match the format above....
========================code to open the textfile in list box, just help to validate the format above=======================
Dim sFile As String
Dim inFile As Integer
Dim sTemp As String
Open sFile For Input As inFile
While Not EOF(inFile)
Line Input #inFile, sTemp
olist.AddItem sTemp
Wend
Close inFile
royaloba
0
Junior Poster in Training
Recommended Answers
Jump to Postroyaloba,
In order to parse out the data you do not want I suggest validating the input line before splitting it into the data() array.
Assuming that you only want the "Access" events in your database I would change your code to the following:
While …
Jump to Posthello sir it's me again.... i finish the validation on saving the textlog... i'm adding a new
field in the Table Its TimeOut here's the senario sir i want to put the first time in fields
TIMEIN, Then last record will be for TIMEOUT..base on their card number! did you …
Jump to PostI want to give a thumbs up to Yomet here.... Keep up the good work.
Jump to PostHi again royaloba,
When I said a SELECT statement I did not mean a SELECT CASE statement but rather a SQL SELECT statement.
Here is the gist of what I would do, this might not work correctly in your program but with minor tweaks it should.
All 15 Replies
Yomet
1
Junior Poster
royaloba
0
Junior Poster in Training
Yomet
1
Junior Poster
Comatose
290
Taboo Programmer
Team Colleague
royaloba
0
Junior Poster in Training
Yomet
1
Junior Poster
royaloba
0
Junior Poster in Training
Yomet
1
Junior Poster
royaloba
0
Junior Poster in Training
royaloba
0
Junior Poster in Training
Yomet
1
Junior Poster
royaloba
0
Junior Poster in Training
Yomet
1
Junior Poster
royaloba
0
Junior Poster in Training
Yomet
1
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.