Solved

MS Access 2003 importing data from excel / appending to table

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
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