|
-
Mar 30th, 2004, 02:26 AM
#1
Thread Starter
Addicted Member
Remove Blank Records From Random Access File
Hi everyone
i have written a simple random access file application but was
wondering how to delete a empty record i am using a UDT like
below
VB Code:
Public Type record
staff_name As String * 20
title As String * 4
initials As String * 4
status As String * 1
room As String * 5
telephone As String * 4
End Type
any ideas how to delete a blank record
thanks for help people
-
Mar 30th, 2004, 09:29 AM
#2
Lively Member
Try this:-
Private Sub CleanUpFile()
Dim CleanFileNum As Integer
Dim i As Long
Dim Confirm As Integer
' removes any duplicates by copying to another file
Confirm = False
CleanFileNum = FileOpener("~~Tmp~~.Tmp", RANDOMFILE, Len(Contact), Confirm)
For i = 1 To LastRecord
Get #FileNum, i, Contact
Put #CleanFileNum, i, Contact
Next i
Close
' rename file
FileCopy "~~Tmp~~.Tmp", FileName
FileNum = FileOpener(FileName, RANDOMFILE, Len(Contact), Confirm)
Kill "~~Tmp~~.Tmp"
End Sub
I found it in the samples for VB3 called fileio\recedit.mak bt I'm not sure if it works for blanks.
Nick
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
|