Solved

MS Access 2003 importing data from excel / appending to table

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

839 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