Results 1 to 5 of 5

Thread: Need help with random access files...

  1. #1
    Guest

    Exclamation

    I have a little problem. My program allows users to delete records from a random access file. It also allows them to enter new records into the random access file. When they delete the record, the program just sets the record fields to "" So the record is still there, just nothing in it.

    Since I don't want to waste to much space, when the user adds a new record, I want the program to look for the first 'available' record to use. By this I mean either the first deleted one it comes to, or add a new one to the end of file, which ever comes first. Then add that record number to a labels caption.

    Here is the code I am using,

    Code:
    Dim QARec As QA
        Dim i As Integer
        Dim first As Integer
        Dim filename As String
        Dim questiontext As String
        filename = strInstallPath & File1.filename
        Open filename For Random As #1 Len = 1500
        Do Until EOF(1)   
            i = i + 1
            Get #1, i, QARec
            questiontext = QARec.Question
            If questiontext = "" Then
                first = i
            End If
        Loop
        Close #1
        lblQuestionNumber.Caption = i
    Also, if you notice I used EOF(1), is this the proper way to use it?

    Thanks for any help you give.


  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    MDB

    you should look into using a database file as they are random access files with everything including the kitchen sink thrown in...
    Perhaps this is a school project and you need to use a random file...in that case ignore this.

    You can build a mdb...look under AddIns..Visual Data Manager
    Visa Data....
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3
    Guest

    Arrow

    I am just learning Visual Basic, and I want to learn Random Access Files. I do plan on converting the program over to a database type file storage, but for now I want to do it the Random way. Thanks anyway.

    Anyone have a solution???????

  4. #4
    Guest
    HeSaidJoe:

    THANK YOU!!
    I have been needing MS access for such a long time..
    and now i dont need it
    THANK YOU!!!!!!

  5. #5
    Guest
    hmmm... anyway, I could still use an answer if anyone has one..

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