Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old October 13th, 2006, 04:05 AM
Registered User
 
Join Date: Oct 2006
Location: Manila, , Philippines.
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....

Reply With Quote
  #2 (permalink)  
Old October 13th, 2006, 12:50 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Alameda, ca, USA.
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Use the Dir function:

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

marcostraf,
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..:)

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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



All times are GMT -4. The time now is 03:40 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.