| | |
How to open multiple textfile
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
Hi,
If u have To Display the records, Ordered by Time,
The Simplest way is to Save all the Records in a Temp Table In Database,
Any Database will do .dbf, or .mdb.
Create a table will all the above fields, Save and
Then Query From the TempTable Order By Date/Time.
Any other Coding if u do will take lots of time, to code as well as check.
To make any file Readonly use this code.
SetAttr "C:\MyTextFile.txt", vbReadOnly
Regards
Veena
If u have To Display the records, Ordered by Time,
The Simplest way is to Save all the Records in a Temp Table In Database,
Any Database will do .dbf, or .mdb.
Create a table will all the above fields, Save and
Then Query From the TempTable Order By Date/Time.
Any other Coding if u do will take lots of time, to code as well as check.
To make any file Readonly use this code.
SetAttr "C:\MyTextFile.txt", vbReadOnly
Regards
Veena
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Open both files Open a new file for the merged data Read a record from each file into Data1 and Data2 Start a loop If Data1 < Data2 then output Data1 read a new Data1 else output Data2 read a new Data2 endif continue with loop
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
•
•
Join Date: Sep 2006
Posts: 54
Reputation:
Solved Threads: 1
hello veena,
can you please help me with this problem, i have a .dat file
the contents is like this
00001 2007-02-12 18:13:13
00001 2007-02-12 18:13:23
00001 2007-02-12 18:13:33
12345 2007-03-12 08:00:09
12345 2007-03-12 09:00:00
00001 2007-04-12 09:08:00
00001 2007-04-12 09:11:00
12345 2007-05-12 08:12:23
00001 2007-05-12 10:11:31
then trying to output the file as text files., split the file base on the date created for their filename i.e. 02122007, 03122007, 04122007, 05122007 see my sample code.. i having a hard time with this one again..thanks in advance
can you please help me with this problem, i have a .dat file
the contents is like this
00001 2007-02-12 18:13:13
00001 2007-02-12 18:13:23
00001 2007-02-12 18:13:33
12345 2007-03-12 08:00:09
12345 2007-03-12 09:00:00
00001 2007-04-12 09:08:00
00001 2007-04-12 09:11:00
12345 2007-05-12 08:12:23
00001 2007-05-12 10:11:31
then trying to output the file as text files., split the file base on the date created for their filename i.e. 02122007, 03122007, 04122007, 05122007 see my sample code.. i having a hard time with this one again..thanks in advance
Hi,
Here I have Changed ur Code and Posted:
I Hope it is clear.
Regards
Veena
Here I have Changed ur Code and Posted:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub Command2_Click() ' Dim inFile As Integer Dim data() As String Dim fields As Integer Dim InLine As String Dim iDate As String Dim NewFile As Long Dim NewFileName As String ' inFile = FreeFile '***Open "C:\TEXTLOG\1_attlog.dat" For Input As #InFile Open App.path & "\1_attlog.dat " For Input As #inFile While Not EOF(inFile) Line Input #inFile, InLine data() = Split(InLine) fields = UBound(data()) iDate = Format(Right(data(0), 10), "MMDDYYYY") ' NewFileName = "C:\Andoks\" & iDate & ".txt" NewFile = FreeFile Open NewFileName For Append As NewFile Print #NewFile, Format(Right(data(0), 10), "YYYY/MM/DD") & " " & Left(data(1), 8) & "," & " " & "Event:Access," & " " & "Door:1," & " " & "Card No.:" & Format(Left(data(0), 5), "00000") & "," Close NewFile '***Print #1, data(0); vbTab; data(1) Wend MsgBox "Attendance successfully downloaded ", vbInformation + vbOKOnly, "Record Saved" Unload Me Me.Show Close #inFile End Sub
I Hope it is clear.
Regards
Veena
•
•
•
•
Veena,
thanks, you've solve my 2nd problem, but still my main problem is if i will download all the attendance from the reader it will save only in one file..this is the sample output file... the file name is base on the date i download the file...12052006.txt
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
2006/12/01 10:53:40, Event:Access, Door:1, Card No.:00011, 2006/12/01 10:53:49, Event:Access, Door:1, Card No.:00010, 2006/12/01 11:01:17, Event:Access, Door:1, Card No.:00010, 2006/12/01 11:01:19, Event:Access, Door:1, Card No.:00011, 2006/12/01 11:03:03, Event:Access, Door:1, Card No.:00012, 2006/12/01 11:03:05, Event:Access, Door:1, Card No.:33333, 2006/12/01 11:03:07, Event:Access, Door:1, Card No.:00123, 2006/12/01 11:03:09, Event:Access, Door:1, Card No.:01234, 2006/12/01 11:04:51, Event:Access, Door:1, Card No.:00015, 2006/12/01 11:05:18, Event:Access, Door:1, Card No.:00016, 2006/12/01 11:05:56, Event:Access, Door:1, Card No.:00015, 2006/12/01 11:05:58, Event:Access, Door:1, Card No.:00016, 2006/12/01 11:06:39, Event:Access, Door:1, Card No.:00015, 2006/12/02 10:53:40, Event:Access, Door:1, Card No.:00011, 2006/12/02 10:53:49, Event:Access, Door:1, Card No.:00010, 2006/12/02 11:01:17, Event:Access, Door:1, Card No.:00010, 2006/12/02 11:01:19, Event:Access, Door:1, Card No.:00011, 2006/12/02 11:03:03, Event:Access, Door:1, Card No.:00012, 2006/12/02 11:03:05, Event:Access, Door:1, Card No.:33333, 2006/12/02 11:03:07, Event:Access, Door:1, Card No.:00123, 2006/12/02 11:03:09, Event:Access, Door:1, Card No.:01234, 2006/12/02 11:04:51, Event:Access, Door:1, Card No.:00015, 2006/12/02 11:05:18, Event:Access, Door:1, Card No.:00016, 2006/12/02 11:05:56, Event:Access, Door:1, Card No.:00015, 2006/12/02 11:05:58, Event:Access, Door:1, Card No.:00016, 2006/12/02 11:06:39, Event:Access, Door:1, Card No.:00015, 2006/12/03 10:53:40, Event:Access, Door:1, Card No.:00011, 2006/12/03 10:53:49, Event:Access, Door:1, Card No.:00010, 2006/12/03 11:01:17, Event:Access, Door:1, Card No.:00010, 2006/12/03 11:01:19, Event:Access, Door:1, Card No.:00011, 2006/12/03 11:03:03, Event:Access, Door:1, Card No.:00012, 2006/12/03 11:03:05, Event:Access, Door:1, Card No.:33333, 2006/12/03 11:03:07, Event:Access, Door:1, Card No.:00123, 2006/12/03 11:03:09, Event:Access, Door:1, Card No.:01234, 2006/12/03 11:04:51, Event:Access, Door:1, Card No.:00015, 2006/12/03 11:05:18, Event:Access, Door:1, Card No.:00016, 2006/12/03 11:05:56, Event:Access, Door:1, Card No.:00015, 2006/12/03 11:05:58, Event:Access, Door:1, Card No.:00016, 2006/12/03 11:06:39, Event:Access, Door:1, Card No.:00015, 2006/12/04 10:53:40, Event:Access, Door:1, Card No.:00011, 2006/12/04 10:53:49, Event:Access, Door:1, Card No.:00010, 2006/12/04 11:01:17, Event:Access, Door:1, Card No.:00010, 2006/12/04 11:01:19, Event:Access, Door:1, Card No.:00011, 2006/12/04 11:03:03, Event:Access, Door:1, Card No.:00012, 2006/12/04 11:03:05, Event:Access, Door:1, Card No.:33333, 2006/12/04 11:03:07, Event:Access, Door:1, Card No.:00123, 2006/12/04 11:03:09, Event:Access, Door:1, Card No.:01234, 2006/12/04 11:04:51, Event:Access, Door:1, Card No.:00015, 2006/12/04 11:05:18, Event:Access, Door:1, Card No.:00016, 2006/12/04 11:05:56, Event:Access, Door:1, Card No.:00015, 2006/12/04 11:05:58, Event:Access, Door:1, Card No.:00016, 2006/12/04 11:06:39, Event:Access, Door:1, Card No.:00015,
it should be separate the file base on there date i.e. 2006/12/01, 2006/12/02, 2006/12/03, 2006/12/04.. then, the file name should be in 12012006, 12022006, 12032006, 12042006...
my code saves them in one file only, that's my main problem...help me please..thanks again..
my code
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Dim dwEnrollNumber As Long Dim dwVerifyMode As Long Dim dwInOutMode As Long Dim timeStr As String Dim iDate As Date Dim i As Long Dim FN As Long FN = FreeFile iDate = Date dwEnrollNumber = 1 CZKEM1.ReadAllGLogData 1 i = i = 1 'Open "C:\TNA\" & Format(Left(timeStr, 10), "mmddyyyy") & ".txt" For Output As #1 While CZKEM1.GetGeneralLogDataStr(1, dwEnrollNumber, dwVerifyMode, dwInOutMode, timeStr) On Error GoTo Err Open "C:\TNA\" & Format(iDate, "mmddyyyy") & ".txt" For Append As #FN 'i = i + 1 If dwInOutMode = 0 Then iInOut = "Event:Access," Else iInOut = "Event:Access," End If Print #1, Format(timeStr, "YYYY/MM/DD HH:MM:SS,") & " " & iInOut & " " & "Door:" & dwVerifyMode & "," & " " & "Card No.:" & Format(dwEnrollNumber, "00000") & "," i = i + 1 Wend MsgBox "Attendance successfully downloaded" Close #FN Err: Resume Next
Hi see thatb you have used CZKEM1 in ur coding can u tellme if it is a userdefined class or a vb class and how to use it i hv been sent a sdk kitin which this piece of coding is used however it does not work it just says method or datat member not found
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: i need help
- Next Thread: Editing Msgbox in visualbasic 6
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






