Problem with exporting my data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

All,

I am trying to export one of my query result to an excel spreadsheet using
the "docmd.transferspreadsheet" option. Everything is working fine except for
this issue. Whenever I export the data, it just overrides any previous data
and place the new one which is fine with me. But if the initial number of
records in the spreadsheet is, say, 10 and when I export a new table that has
only 5 records, docmd option overrides the first 5 records and leaves the
remaining 5 as it is, which I don't want. I want excel to have only the 5 new
records. So this is my question...Is there a way to tell excel to clear all
the previous records before access does the export? If there is any other
easy alternative, please let me know as well. Thanks in advance for your help!
 
The only way I can think of would be to use Automation to clear the data in
the spreadsheet first.

Check my July, 2005 "Access Answers" column in Pinnacle Publication's "Smart
Access" for an introduction to automating Excel. You can download the column
(and sample database) for free at
http://www.accessmvp.com/djsteele/SmartAccess.html
 
I use the OutputTo action of a macro (which may be saved as VB).
It has the Object Type (table, query,etc)
Object name,
Output format (Excel and other various options)
Output file (Path and file name)
Autostart (automatically opens the output file)

This will REPLACE your existing file, but works well.

SteveD
 
Back
Top