Solved

Excel Import into Access 2007

Posted on 2012-04-05
6
308 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 250 total points
ID: 37813790
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 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 250 total points
ID: 37813903
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
ID: 37813932
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 250 total points
ID: 37813936
upload a copy of the db and excel file
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 250 total points
ID: 37823661
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
ID: 37848035
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

734 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