Opening file: – The open statement used in visual basic to open a sequential access data file as well as to open a random-access data file. If a data file is opened in random method, two items increases instead of sequential access method. An access mode and a record length must be specifying with open statement which is not use in sequential access method. The access mode indicate that the random file is open either input, output or both input-output purposes. Record length specifies size of the record. Syntax of the open statement is –
Open <File Name with path> For Random [ACCESS Access_Mode] As <File Number> <LEN=Record Length>
Where file name is the name of file where a record in that file in stored, and record length is the integer length of each record in the file. The value of access indicates the type of operation will be permitted on the file such as READ, WRITE, READ WRITE is assumed.