# Records in a RANDOM ACCESS file? 
Author Message
 # Records in a RANDOM ACCESS file?

Thank you.
-=-=-=-=-=-=-=-=-
Skittles

http://www.*-*-*.com/ ~rampersad

Righteousness is not appreciated.  Thoughtfulness is.
                                        - Karen Kijewski
                                                Author of Wild Kat
-=-=-=-=-=-=-=-=-



Wed, 12 Jan 2000 03:00:00 GMT  
 # Records in a RANDOM ACCESS file?

I'm assuming you want to know how to find the number of records in a
random access file?

This is done as follows:

LengthofFile = LOF(FileName$)
TotalRecords = LengthofFile/ RecordSize

In the above example, you would replace FileName$ with the name of the
random access file you're opening.  RecordSize is the length of a
record in the file.

Charlie

Quote:

>Thank you.
>-=-=-=-=-=-=-=-=-
>Skittles

>http://www.globalserve.net/~rampersad

>Righteousness is not appreciated.  Thoughtfulness is.
>                                        - Karen Kijewski
>                                                Author of Wild Kat
>-=-=-=-=-=-=-=-=-

The All Basic Code HomePage
http://charlie.simplenet.com/abc/abchome.html


Thu, 13 Jan 2000 03:00:00 GMT  
 # Records in a RANDOM ACCESS file?

Remove MAPSON when replying via email

? Does someone know how to find out the total
? number of records in a random access file?

LOF returns the bytecount for the file; divide this by the length of each
row, and Robert's your father's brother.

EG

Type MyRowType
        Name As String * 20
        Address As String * 80
        PostCode As String * 8
End Type
Dim MyRow As MyRowType
MyFile = FreeFile
Open "MYDATA.DAT" For Random as MyFile Len = Len(MyRow)
NoOfRows = Lof(MyFile) \ Len(MyRow)

Bump up NoOfRows before appending a new row:-

NoOfRows = NoOfRows + 1
Put MyFile, NoOfRows, MyRow

Rob Davis MSc MIAP  Leicester, UK  0976 379489



Fri, 14 Jan 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. number of records in a random access file?

2. Delete a record from a Random Access File?

3. Random access files - having and finding multiple types of record in one file

4. Last record in Random Access File

5. Random Access File - Deleting records

6. How to delete record in random-access file?

7. Accessing Access Random Records

8. Max record length on Random Access?

9. random access a record

10. reading binary file and writing into a random access file

11. Random Record Access

12. random access file - write to file

 

 
Powered by phpBB® Forum Software