Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Importing a CSV file in lieu of an XLS file

Status
Not open for further replies.

pnabby

IS-IT--Management
Aug 29, 2004
46
US
I finally figured out how to write the macro and use a command button in an Access form to run the macro and import data from an Excel spreadsheet into an Access table.

I have 2 remaining issues.

1. Originally the data is updated and downloaded into a CSV file, and I would prefer that the user not have to go and save the file as an XLS file before bringing it into Access. Any ideas?

2. If you hit the button more than once, the data is duplicated in the table. I can't set the data to no duplicates because some fields will be duplicated. For example, I am downloading stock closing prices for a series of days like below and the ticker is duplicated:

Ticker Date Open High Low Close
AA 10/1/2004 33.93 34.09 33.71 34.01
AA 10/4/2004 34.01 34.08 33.6 34.06
AA 10/5/2004 33.85 34.2 33.52 33.56
AA 10/6/2004 33.5 34.28 33.4 34.16
AA 10/7/2004 34.28 34.6 34.08 34.08

However, I do not want the combination of the date/ticker to be duplicated. Any suggestions?

Thanks,
Julie
 
Importing from a csv file is the same procedure as importing from an xls file. File>getexternalData>Import.

To prevent duplicates based on date and ticker you set the primary key to be both of these fields in the table design (Select both fields and click the Primary key button)
 
My macro is using the transferspreadsheet function. How do i do what you're describing?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top