Importing wrong order from text.file

D

David Heller

I am trying to import a space delimited text file using
import wizzard. I can get the 33,000 records to break
into 28 fields with no error messages, but when I look at
the new table it is out of order. There is no field in
the text file that I can use to get this back in order.
Does anyone have an idea how to get the records to create
in the same order as the text file? It does it at the
start and finish of the file, but some areas are mixed up
inbetween.

Thanks
 
G

GVaught

If you are importing into a table that has a primary key designated the
order of the files will be based on the primary key and not in the order of
the import.
 
J

John Nurick

Hi David,

Access tables don't have any inherent order, and the only order you can
impose is by using a query that sorts on one or more fields in the data.

So if there isn't a combination of fields that you can use to sort it,
you're stuck.

The simplest thing to do IMO is to add a line number to the textfile
before you import it. If you've got Perl on your machine, try something
like

perl -ne"print qq($. $_)" myfile.txt > newfile.txt

Otherwise, download the Windows versions of Gnu utilities from
http://unxutils.sourceforge.net and use nl.exe to add the numbers.

Then import, creating an index on the line number, and sort on it
whenever necessary.


I am trying to import a space delimited text file using
import wizzard. I can get the 33,000 records to break
into 28 fields with no error messages, but when I look at
the new table it is out of order. There is no field in
the text file that I can use to get this back in order.
Does anyone have an idea how to get the records to create
in the same order as the text file? It does it at the
start and finish of the file, but some areas are mixed up
inbetween.

Thanks

John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
 

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