Solved

Read records into a buffer

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel object stays open 19 73
Macro which automatically send Excel spreadsheet to Outlook problem 2 65
Modifying Conditional Format from VBA code 3 55
Child Form in front 4 46
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

786 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