Export of table jumbled

  • Thread starter Thread starter William LaMartin
  • Start date Start date
W

William LaMartin

I have noticed that for some tables when I export them to, say, a comma
delimited file or to an XML file, the order of the records in the export is
not the same as they display in the table. Every record is in the export,
but perhaps what appear as records 1 - 100 in the table may appear, say, as
starting at record 573 in the export.

The table in question was created with a make table query and has 11,675
records and five fields.
 
Never assume anything about the physical order of records in a table. Think
of tables as "sacks of data": the individual rows will be put wherever they
fit.

The only way to ensure the order of the records is to use a query with an
ORDER BY clause in it. Note that you can export such queries, rather than
the tables themselves.
 
That is what I did.

I had a table, say, MyTable. I then created a query, MyOrderedQuery that
ordered MyTable by a field, say MyField. Everything displayed fine, so I
wanted to turn this query into a table. To do this I created a make-table
query that took the MyOrderedQuery and created a table called
MyTableOrdered. Everything displays fine in MyTableOrdered.

Finally, I want an ID field for MyTableOrdered, so I inserted a new auto
number field Called Id. Everything displays fine with the records starting
at 1 and ending at 11,675.

However, when I export this table to an XML file, the first record is ID
527. And, in general, blocks of records seem to be inserted at random
places. All the records are there with no duplicates, the order is just not
correct.
 
However, when I export this table to an XML file, the first record is ID
527. And, in general, blocks of records seem to be inserted at random
places. All the records are there with no duplicates, the order is just not
correct.

Reread Douglas' message.

A Table HAS NO ORDER. It makes *no* difference whatsoever how the
table was created. It still HAS NO ORDER.

In order to export records in a particular order, you must - no
options, no choice - export directly from a sorted Query, not from a
table.
 
Back
Top