Solved

Read records into a buffer

Posted on 2004-10-01
2
177 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

863 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now