Solved

Excel Import into Access 2007

Posted on 2012-04-05
6
295 Views
Last Modified: 2012-04-15
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?
0
Comment
Question by:rrudolph
  • 2
  • 2
  • 2
6 Comments
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 250 total points
Comment Utility
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...
0
 
LVL 119

Assisted Solution

by:Rey Obrero
Rey Obrero earned 250 total points
Comment Utility
use recordsets, read the excel file, row by row and insert to table as you go.
0
 

Assisted Solution

by:rrudolph
rrudolph earned 0 total points
Comment Utility
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
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 119

Assisted Solution

by:Rey Obrero
Rey Obrero earned 250 total points
Comment Utility
upload a copy of the db and excel file
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 250 total points
Comment Utility
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...
0
 

Author Closing Comment

by:rrudolph
Comment Utility
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.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now