Results 1 to 2 of 2

Thread: Using a Data file

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2001
    Posts
    143

    Using a Data file

    Ok, how do i use a dat file? I want the dat file to collect the highest amount of "sales" in my project. I know i gotta use a Do while loop, but i'm not fulent with that. Basicly my Dat file looks like this:


    Dailysales.dat
    101
    10.00
    5.00
    124.75
    -1
    102
    32.50
    67.00
    4.95
    -1
    101
    43.00
    25.00
    -1
    103
    27.75
    34.65
    2.00
    -1

    That it for the dat file, but 101 , 102 ,103 are ID numbers fro Joe,Mary and Ted.

    Thanks for any help.

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    Something like this:
    VB Code:
    1. Dim intFFN As Integer
    2.     Dim dblAmount As Double
    3.     Dim strBuffer As String
    4.    
    5.     intFFN = FreeFile
    6.    
    7.     Open "C:\Dailysales.dat" For Input As #intFFN
    8.    
    9.     Do Until EOF(intFFN)
    10.         Line Input #intFFN, strBuffer
    11.        
    12.         If dblAmount < CDbl(strBuffer) Then dblAmount = CDbl(strBuffer)
    13.     Loop
    14.    
    15.     Close #intFFN
    16.    
    17.     MsgBox "The highest amount is " & dblAmount

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