Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MS Access 2003 importing data from excel / appending to table

Posted on 2004-04-21
5
Medium Priority
?
1,076 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 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

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

722 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