View Full Version : Inserting a line into a text file in alphabetical order


battlecat
08-19-2004, 11:29 PM
Hi,

I was wondering if anyone knows off-hand a good algorithm to insert something in alphabetical order?

I have a text file that has information on each line in alphabetical order. Sometimes additional info needs to be added, and needs to be written to the right line to keep everything in order....

I guess this doesn't related directly to access db's, but this is a functionality that I need to add to mine... so if anyone has any suggestions, I'd be ever so greatful!!!!

bjackson
08-20-2004, 12:54 AM
Heres one way
Link to the file from your db.
Run a make table query on the linked file
Add your record to the table
Re write a new file based on that table sorted in the order you require
Overwrite the original txt file.All this could be acheived with one button click

Regards
Bjackson

battlecat
08-20-2004, 03:11 PM
hi bjackson... I did just as you said and it worked perfectly! Thanks so much for the advice :)