Exporting from Access

J

Jeff

Hi,

I am exporting a Table from access to my C: drive. It is exported as a
".csv" file.

Table = 4 columns 150,000 rows

Here is the problem - the table is sorted in access but when it is exported
it is not sorted anymore. How can I export the csv file such that the rows
are still in the same order.

Also why does access export unsorted?

Thanks for your help.
 
J

Jeanette Cunningham

Hi Jeff,
the trick is to create a query based on the table and specify the sort order
you want.
Export the query. Tables are not meant to store data in any particluar
order, queries are the tool to do the sorting.

Jeanette Cunningham
 
J

Jeff

That does not answer my question -
are you telling me that there is no way to sort it?

This is a major flaw in Access. Also another flaw is that the decimal place
is truncated unless you specify "formatt" in the query but that is another
issue.

This makes it very hard to use access with other programs.

Is there any other database program that can sort a table?
 
J

Jeanette Cunningham

Jeff,
I thought that you wanted just the data from the table, but it sounds as if
you need the table as well.
I'm not sure what other program you are using, would it be possible for your
other program to import the query into one of its own tables.
These are just suggestions as I am pretty much in the dark about your needs,
if they aren't what you want, just delete them.
Access can export the query to excel or txt or csv files - maybe this would
help you.

Jeanette Cunningham
 
J

Jeanette Cunningham

Jeff,
Oops! Please ignore my most recent post, I did not read your question
carefully enough.
Is there a problem with sorting the query to match the sort order in the
table?
If so, you could add an additional long integer field to the table and
append seqential numbers to it.
Use this sequential field to sort the query the same way the table is
sorted.
Then when you export the query as a csv file it should be sorted the way you
want.

Jeanette Cunningham
 
A

Albert D. Kallal

Jeff said:
That does not answer my question -
are you telling me that there is no way to sort it?

The very definition of modern database and information management systems is
that if you need some particular order, you must specify that order.

It is likely that you are new to the concepts of computing and computing
science and the computer industry in general, so you're new to this stuff,
and that's not really a problem.

Just read on a little bit more and I explain much why systems work the way
they do:

The solution is as mentioned is to use a query and YOU must set the order of
data. You MUST have some means of setting the order. Remember in a multi
user environment someone might edit data that will change the order in which
you need the data. If you have ten people from 10 different locations from
around the world and they ALL start entering data into the SAME table, then
the last ten records you just entered are from ten different people from ten
different countries around the world. You can rapidly see it becomes a pink
cloud fantasy to ensure order of data in a physical sense. At this point in
time, how would order of data entry matter in any way shape or form, because
of multiple people entering records together from multiple sources , you
simply have a mumbo jumbo of records intermixed. because the new modern
database in jeans are multi user, then the industry as a general hold
decided that the only way to ensure order of data is for the designers of
the application software to specify some order of data. And

THAT means given to you is a query!

In fact for more than fifteen years MS access NEVER guarantees the order of
data in which you enter the data. That means if you enter ten records into a
table, and go back and edit the fifth to record, it might jump to the
seventh position in the table. you can certainly set a sort order on a table
in access any usually remembers it, but when it comes down to making a
report, then you must use the sorting and grouping options of that report to
set the order.

In the case of exporting data to a csv/text file, you simply MUST use a
query, and MUST set the order in that query to order the data in the order
that you desire to have for the export. If your original table does not have
some means of ordering the data, then you cannot in any fashion be sure that
order will be maintained during an export.

again:
a database is considered an unordered collection of data. YOU MUST set the
order of data by using a query that orders your data in a fashion that you
require your data. There's simply no other solution and no other approach in
the modern computing industry that works any other way.
This is a major flaw in Access.

And Sql server, and MySql, and Oracle, and Informix, .and d3....and
virtually every major single database product in the marketplace works this
way

I'm really not sure why or what the problem is preventing you from exporting
this data via a query?
Also another flaw is that the decimal place
is truncated unless you specify "formatt" in the query but that is another
issue.

in general the approach is to simply use the format command and you can
format the export data as you desire...
 
J

Jeff

Albert.

I did sort the table in Access. The table is sorted correctly (in Access I
used the filter feature) . The problem is that when I export it - then it
is not sorted anymore.
 
J

John W. Vinson

Albert.

I did sort the table in Access. The table is sorted correctly (in Access I
used the filter feature) . The problem is that when I export it - then it
is not sorted anymore.

Reread Albert's excellent and accurate description.

A Table in Access is best viewed as an unordered "heap" of data, a repository
for records.

The Filter feature changes how that heap is displayed. It does not affect how
the data is stored. Data display and data storage are two different things.

You're asserting that Access is lacking because it does not export the data
the way you want it from the Table. Access is in fact NOT lacking; you're just
not using the tools that it provides!

You CAN export the data in the desired order. The way to do so is to create a
Query sorting the data in the desired order, and export that Query.

Please don't blame the tool because you're misusing it. Sorry to be harsh, but
you're being pretty harsh yourself.

John W. Vinson [MVP]
 

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