|
-
Jun 11th, 2000, 07:31 AM
#1
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|