Data Read in VBA

  • Thread starter Thread starter Joe Bowen
  • Start date Start date
J

Joe Bowen

I have a requirement to read in a set of data. The order of the data itself
is important, and I have to sequence through it to do the proper processing
for table insertion. How do I do a record-by-record access of a table?
I've been trying to understand recordsets and readnext(), but it's not
clear.

The raw set of data has a name field. It will be the same for the first
several records. They are all associated, and I am inserting a relation to
another table to make this association. For the next record, the name will
be different (the logic is more complex than that). So the next group of
records are related. Then the first name reappears. That is a THIRD group,
because of the order in which they occurred.

So that's the problem.

Thanks,
Joe
 
Joe said:
I have a requirement to read in a set of data. The order of the data itself
is important, and I have to sequence through it to do the proper processing
for table insertion. How do I do a record-by-record access of a table?
I've been trying to understand recordsets and readnext(), but it's not
clear.

The raw set of data has a name field. It will be the same for the first
several records. They are all associated, and I am inserting a relation to
another table to make this association. For the next record, the name will
be different (the logic is more complex than that). So the next group of
records are related. Then the first name reappears. That is a THIRD group,
because of the order in which they occurred.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You could use the SQL ORDER BY clause to "group" the records in the
Recordset. E.g.:

SELECT ...
FROM ...
WHERE ...
ORDER BY LastName, DOB, HairColor

This recordset would order the results by LastName, DateOfBirth and
HairColor. Something like this:

LastName DOB HairColor
- -------- -------- ---------
Smith 1/2/1979 Black
Smith 1/2/1979 Red
Smith 2/28/1979 Blond
Smith 3/1/1980 Brown
Smith 3/1/1980 Red

- --
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQFez14echKqOuFEgEQKJ8gCgvb2fHdmgS1OF5twmj28f+72EV3wAn06T
6zohq746f7ZQzOfHqveWSJm5
=vSr9
-----END PGP SIGNATURE-----
--
 
Back
Top