Solved

MS Access 2003 importing data from excel / appending to table

Posted on 2004-04-21
5
1,028 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 500 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

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

708 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

15 Experts available now in Live!

Get 1:1 Help Now