?
Solved

Read records into a buffer

Posted on 2004-10-01
2
Medium Priority
?
182 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 690 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
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…
Suggested Courses
Course of the Month11 days, 22 hours left to enroll

752 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