Results 1 to 3 of 3

Thread: saving to files

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Location
    Cairns,North Queensland, Australia
    Posts
    21
    I have a form with numerous textboxes and a save button,when I fill the textboxes I save the info to a file with the open statement and the text in one of the textboxes goes into a listbox to be recalled at a later date and printed out and or altered and resaved.My question is how can I save to a different file each time I fill in the textboxes with a new set of info so that I can build up the listbox with up to fifty or more items.

  2. #2
    Guest
    You could generate random numbers and save to files with the numbers as a file name:

    Code:
    Public Function GenerateRandom(minVal As Long, maxVal As Long) As Long
        intr = -1
        maxVal = maxVal + 1
        If maxVal > 0 Then
            If minVal >= maxVal Then
               minVal = 0
            End If
        Else
            minVal = 0
            maxVal = 10
        End If
        Randomize (DatePart("s", Now) + DatePart("m", Now))
        Do While (intr < minVal Or intr = maxVal)
            intr = CLng(Rnd() * maxVal)
        Loop
        GenerateRandom = intr
    End Function
    
    code:
    
    i = GenerateRandom(1000000, 9999999) 'Generate a number from 1000000 to 9999999
    
    Open (App.Path & "\" & i & ".txt") For Output As #1
    Print #1, text1
    Close #1

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Location
    Cairns,North Queensland, Australia
    Posts
    21

    Thumbs up

    Thank you Matthew, your reply is greatly appreciated.

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