Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MS Access 2003 importing data from excel / appending to table

Posted on 2004-04-21
5
Medium Priority
?
1,083 Views
Last Modified: 2008-03-03
Hi all,
I am trying to import an excel file into an existing table of an Access DB, however it wont allow me to carry out the import! I will need to carry out such an import on a daily basis! So should i be appending?? If so any info on how would be appreciated!
Basically I have organised both the excel and Access sheets in the same order(i.e. Field Names in both correspond)! However I need to have an autonumber assigned to my Access data (this is not contained in my Excel sheet). I also do not want to import the Excel headings as this would override the current settings within the Access DB, e.g some of the fields are set as list boxes and contain look-ups for manual input (can these still be kept?)

The import seems to works when i import to a new table, however is it possible to populate a field that is in fact formatted as a list box, containing data from another table, even if the data in the excel spreadsheet is in the same format??

Apoligies for the over complication of the issue due to my difficulty in getting the point across!!
0
Comment
Question by:findorg
  • 3
5 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 10879453
have you looked at creating import specifications?

On the File menu, point to Get External Data, and then click Import.
On the Import page, click the Microsoft Access database with the desired import/export specifications, and then click Import.
On the Import Objects screen, click Options.
Under Import, click to clear the Relationships check box. Click to select the Import/Export Specs check box, and then click OK.

you might be able to build something up which enables you to bypass the autonumber

0
 

Author Comment

by:findorg
ID: 10886326
I am unable create import specifications as it is an MS Excel spreadsheet that I am trying to import, so I am not getting the option to specify
0
 
LVL 28

Accepted Solution

by:
burrcm earned 2000 total points
ID: 10907265
Perhaps you could import the spreadsheet into a new table, then use an append query to add the new data to the first table. You could then delete the new table. The autonumber will be added automatically during the append.

Chris B
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 10916855
The Specifications should be available when you click on the Advanced button


0
 
LVL 65

Expert Comment

by:rockiroads
ID: 10916918
Say I have a table with two fields

ID (AutoNumber)
Desc (String)

Have a spreadsheet with one column titled Description
I inserted a blank column at the start and titled it ID
(this matches table)
Saved this as a CSV file

In MSAccess, go to Get External Data/Import, select my CSV spreadsheet,
Selected Delimited, clicked on Next the selected Comma
At this point I clicked on Advanced
Since my CSV file has two fields, its auto calls it Field1, and Field2
I renamed it to be my fields in the DB file (ID, Txt)
then I selected Skip on ID (first field)
clicked on SaveAs and called it XXXX


now that is my specification saved


I then aborted this import (but you can carry on if you choose to do so)


How I loaded it in code is as follows

    DoCmd.TransferText acImportDelim, "XXXX", "<tableName>", "C:\Imp.csv", True

where C:\Imp.csv is the name of my csvfile
True specifies whether csv file has heading or not


0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

926 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