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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to clear all data from external spreadsheet from within access

Status
Not open for further replies.

mully1

Programmer
Jan 27, 2009
6
GB
Hi, my database imports data from a spreadsheet into a temporary access table. When finished with the temporary access table i use a macro to clear down the table but i also need to be able to clear down the data in the external spreadsheet, from access, if possible. This is because a scheduled cognos report runs weekly from my pc & the output is saved into this (blank) spreadsheet. Then the user uses the db to import the spreadsheet into the DB (weekly)& the DB processes the info as required & then clears down the temp table. I need the spreadsheet cleared down before the scheduled report next runs - is it possible to do this from within access? I tried using a macro - transfer spreadsheet to export the now blank temp table to the spreadsheet but this appends a worksheet to the spreadsheet rather than overwriting it. Any ideas would be really appreciated, thanks.
 
I am guessing that you import the data from the spreadsheet each time it is required.

I would suggest that instead of this, the spreadsheet is treated as a linked table. You should then be able to manipulate the data in the spreadsheet in any way you want.

Hope this helps.
 
Thanks for your reply hjoldstein. When i use the spreadsheet as a linked table shoudl i be able to clear it down using a delete query? When i try i get the error: Deleting data in a linked table is not supported by this ISAM. (Error 3617)
 
Create a template file Set up as the congos import file is
and call it
congosimportTmeplate.xls


After you do the import Just overwrite the import file with the template

Code:
filecopy "congosimportTmeplate.xls","congosimport.xls"
 
Thanks pwise - sorry for sounding stupid but do you mean i would use that code in access to overwrite one spreadsheet with the other? Would this be using a macro?
 
You can do it in a macro?

How do you do the the the import export ect
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top