|
-
Aug 20th, 2000, 10:19 AM
#1
here is my code:
FileNumber = FreeFile()
Open "C:\TestFile.txt" For Random As FileNumber Len = Len(rec)
Do Until EOF(FileNumber)
i = i + 1
Get FileNumber, i, rec
Loop
'rec is the UDT;
'variable i will return the number of records
'that are in the file
the problem i have is when i delete a record
the length of the UDT still remains in the file
which therefore, in my case, variable i will return an
incorrect number.
if anyone knows a way to remove the dead space from
a deleted record in a random access file let me know
-
Aug 20th, 2000, 12:22 PM
#2
Member
You can remove spaces by loading all the data into an array (if you don't know about arrays there is a good tutorial on http://www.vb-world.net at the moment) then loop through all of the items in the array ( The highest item number can be found by using the UBound command e.g:
LastItem = UBound(Array())
Where LastItem is the highest item number and Array() is your array containing the data you have loaded. Before writing them to the file you can check the value of the item, if it is equal to nothing ("") then skip the write function on that occasion.
Hope this helps if you need further help or examples please feel free to contact me on
icq: 33122184
or by e-mail: [email protected]
Grant
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
|