Excel Import into Access 2007

I need to export a spreadsheet sheet  into a new Access Table. No problem doing so, when I manually run the import, the rows come into the table in the same order as the spreadsheet, which is exactly what I want. When I run this in a Macro using RunSavedImportExport, the import works fine, but the order of the data is different than in the original spreadsheet. This is a problem for me as I use the contents of the data in the first 3 rows to run a series of modules.

How do I keep the same order in the table as I had in the spreadsheet? I am not using any Keys or auto numbering?
Rick RudolphAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeffrey CoachmanMIS LiasonCommented:
This is why I try to create a "Numbering" (SortBy) column in Excel too.

This way even if the data comes in with the wrong order, you can resort the fields (via Indexing or setting the SortBy column as the Primary key) in the Access table correctly.

Perhaps another Expert has something more elegant...
Rey Obrero (Capricorn1)Commented:
use recordsets, read the excel file, row by row and insert to table as you go.
Rick RudolphAuthor Commented:
Can you point me to a code snippet that would show this in action:

Spreadsheet Name is:  MasterPrice_Template.xls
Sheet Name is: Export
Access Table is PriceImport

Keep in mind, I never know how many columns or rows the spreadsheet will have

Thank you
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Rey Obrero (Capricorn1)Commented:
upload a copy of the db and excel file
Jeffrey CoachmanMIS LiasonCommented:
A table, technically, does not have an "Order"
If you need the records in a certain order, then why not simply create query to sort them in that order?

In other words, I am not quite sure why the table needs to import in a certain order...
If the table does not import in your specific order, then make a query to do so...

A query can be used just like a table in most cases...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rick RudolphAuthor Commented:
I ended up adding a key field programatically and sorting the record set the way I wanted to read the records. Nobody furnished a silver bullet, but all help was appreciated and did confirm what I already suspected.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.