Solved

Read records into a buffer

Posted on 2004-10-01
2
181 Views
Last Modified: 2010-05-02
I have the following type defination in my code

Type ColorChart
    ChartNumber As Long
    EmployeeNumber As Long
    ChartDay As Byte
    ChartMonth As Byte
    ChartYear As Integer
    ChartDeleted As Byte
End Type

this defination is used when reading and writing to a binary file using the following Var

Public CChart As ColorChart

I am currently looping through each records in the binary file to read in the records.  (this is an old app and the data structure was designed before I came along)

I have been told that if I read a couple of records into a Buffer at 1 time that this would be the fastest way of reading the file.

How do I use a buffer - and how do I calculate how may records I can read into a buffer?



0
Comment
Question by:CiaranG
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 230 total points
ID: 12199551
You must use an array similar to:

Dim Buffer(10) As ColorChart

Then, don't read 1 structure at a time, but 10
Also you can use a control variable to specify buffer size and another to specify record number of first element. This will increase the access speed noticeably.
0
 

Author Comment

by:CiaranG
ID: 12206976
Well I am reading records using the following

get #chartfileno, (len(colorchart) * looper)+1), colorchart

how do I read 10 records into a buffer at once?



Thanks
CiaranG
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question