Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 13th, 2006, 04:05 AM
Registered User
Join Date: Oct 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to royaloba
Default 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....

Old October 13th, 2006, 12:50 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts

Use the Dir function:

fileName = Dir("C:\textlog\*")
if len(filename) = 0 then exit do
===do something here with fileName
fileName= Dir
Old October 27th, 2006, 12:18 AM
Registered User
Join Date: Oct 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to royaloba

thanks for your reponse sir, but my problem is i'm not that familiar with in terms of reading text files...
i'm very thankfull is you can provide me a sample code..:)

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to load multiple Images on the Form? shah123 C# 1 May 20th, 2007 09:28 PM
multiple textfiles to one textfile for import Marleen Access VBA 5 September 28th, 2006 09:03 AM
Sql loader failing to load into multiple tables amol_mudholkar Oracle 0 August 12th, 2004 03:32 PM
Appending to a TextFile jfleming SQL Server DTS 3 June 16th, 2004 08:45 AM
Importing a TextFile, best way ioates SQL Server 2000 1 June 27th, 2003 07:24 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.