Help

G

Guest

The sort order of the table comes out different after it has been processed
in a module. I didn't anticipate that happening at all - the first record in
is the first one out and so on to the last record in is the last record out -
but that is not what Access is doing. Any way to tell Access to maintain the
record order on the table?

More Details:
I read a table generated by a query into a recordset using the following
code:

Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("myQuery")

The table is sorted in the "myQuery" .

Then we read the recordset one record at a time and output the record:
rst.MoveFirst
Do Until rst.EOF
Call OutputRec(dbs, rst, outTable) 'Sub that executes sql insert statement
rst.MoveNext
Loop

The output table is NOT in the same order as input data from myQuery.

Is there any way to make Access maintain the sort order? Maybe its me, but
its crazy that the order isn't maintained in such a simple process.

Thank you,
Mark
 
W

Wayne Morgan

Don't count on records being in a table in any particular order. If you need
them sorted, use a query based on the table(s) and tell it how you want the
records sorted.
 
G

Guest

Wayne -

Thanks for the comment.

At least I know there is not some table property which would maintain the
record order. I'll figure some work around.

I'm from the old school where record in and record out processing means just
that.
 
D

David C. Holley

You may have stated this but, What is the specific need to process the
records in the order in which the were entered? (Which of course is
possible if you use a field to capture the date/time the rec was added
and sort on that field.)
 
W

Wayne Morgan

The "work around" is a query. That is one of the reasons they are there. If
you need to sort the record chronologically, then include the date and time
the record was created and/or edited in a field in the record itself and
sort on that field in the query. You can also create your own sequential
number field that will indicate which record was entered before/after
another record.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top