Results 1 to 5 of 5

Thread: Is there a quicker method

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Location
    London Occupation: Desktop Developer
    Posts
    141

    Question Is there a quicker method

    Hi was wondering if anyone could look over the following process and give any suggestions for speeding it up, using VBA in Access 97, I am open a file reading it line by line, for each line that is read I am formating the data and writing to a new file. The process takes about 20 minutes (100/150MB file)

    VB Code:
    1. Open "C:\PostPay\file" & strType & lngProcessID & ".txt" For Input As #1
    2. Open "C:\PostPay\fileResult" & strType & lngProcessID & ".txt" For Output As #2
    3.  
    4.  
    5. Do Until EOF(1)
    6.   Line Input #1, strFile
    7.  
    8.   'Ignore the header
    9.   If Not (InStr(1, strFile, "|") > 0) Then
    10.  
    11.     vntArray = Split(strFile, ",")
    12.    
    13.     For intCount = 0 To 16
    14.       'Edit the File
    15.  
    16.       If intCount = 0 Then
    17.      
    18.         Select Case Mid$((vntArray(intCount)), 2, 3)
    19.        
    20.           Case "GRA"
    21.             'Grand Total - MUST ALWAYS INCLUDE OR ABORT PROCCESS
    22.             strFile = Trim$(Mid$(vntArray(intCount), 2, 11))
    23.             blnGrandTotal = True
    24.            
    25.           Case "EH_"
    26.             'Guiding only
    27.             strFile = Trim$(Mid$(vntArray(intCount), 2, 9))
    28.           Case Else
    29.             'Exclude spaces and ".rcd"
    30.            
    31.             strFile = Trim$(Mid$(vntArray(intCount), 2, InStr(1, vntArray(intCount), ".rcd") - 2))
    32.       End Select
    33.      
    34.       Else
    35.         strFile = strFile & "," & Trim$(vntArray(intCount))
    36.       End If
    37.     Next
    38.    
    39.     Print #2, strFile & "," & dtmDate & "," & lngProcessID
    40.    
    41.   End If
    42. Loop
    43.  
    44. Close #1
    45. Close #2

    Any help much appreciated
    Last edited by Richyrich; Feb 28th, 2002 at 04:58 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width