VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This Code Read the Filenames From partcular folder and Convert the String in to database Feilds ...

by Mittu Pithadia (1 Submission)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 20th April 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This Code Read the Filenames From partcular folder and Convert the String in to database Feilds ..... Feel Free to ask more on this......NJOY

Rate This Code Read the Filenames From partcular folder and Convert the String in to database Feilds ...



Dim cnt As Integer
Dim Str As String
Dim fso, f, f1, fc, Filename
Dim Win As String
Dim Fdate As String
Dim Str1 As String
Open_FlatFile1              ' Open Recordset of flat file
Open_Convertlog


Set fso = CreateObject("Scripting.FileSystemObject")            'Created Object To read file from Folder
Set f = fso.GetFolder(App.Path + "\FlatFile\")
Set fc = f.Files

For Each f1 In fc
Filename = f1.Name
Win = Mid(Filename, 5, 4)
    pathname = App.Path + "\FlatFile\" + Filename
    Open pathname For Input As #1
    Do While EOF(1) = False
        Line Input #1, Str
        cnt = cnt + 1
        If cnt = 6 Then
        Fdate = Right(Str, 10)
        End If
        
            If cnt >= 11 Then
                If IsNumeric(Mid(Str, 1, 1)) Then
                    Rsp1.AddNew
                    Rsp1.Fields!Window = Win
                    Rsp1.Fields!sample = Mid(Str, 1, 8)
                    Rsp1.Fields!phoneNr = Mid(Str, 9, 11)
                    Rsp1.Fields!Time = Mid(Str, 21, 2) + ":" + Mid(Str, 24, 2)
                    Rsp1.Fields!Line = Val(Mid(Str, 26, 5))
                    Rsp1.Fields!ECE = Mid(Str, 31, 25)
                    Rsp1.Update
                Else
                    Exit Do
                End If
            End If
        Loop
        MsgBox "File Converted Successfully!"
        cnt = 0
        Close #1                          
next

Download this snippet    Add to My Saved Code

This Code Read the Filenames From partcular folder and Convert the String in to database Feilds ... Comments

No comments have been posted about This Code Read the Filenames From partcular folder and Convert the String in to database Feilds .... Why not be the first to post a comment about This Code Read the Filenames From partcular folder and Convert the String in to database Feilds ....

Post your comment

Subject:
Message:
0/1000 characters