As you're written it, I'm not surprised it won't work. The 3rd and 4th
arguments (where you have [ReportData] and [ReportName]) are supposed to be
string expressions.
If ReportData and ReportName are variables that contain the name of the
table and the full path to the spreadsheet to which you're trying to export,
try removing the square brackets from around them.
If ReportData is actually the name of the table, put it in quotes.
DoCmd.TransferSpreadsheet acExport, 8, "ReportData", "C:\ReportName.xls"
Note that if you do not put a full path in front of the spreadsheet name,
you may have problems finding the resulting spreadsheet, as it will be
written to the current directory, which usually is not the directory where
your MDB resides.

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
> Access97
> I am using the following to transfer the contents of a table into an
[quoted text clipped - 18 lines]
>
> Piri
Piri - 06 May 2008 21:11 GMT
Hello Doug,
Thanks for the reply. Yes the arguments are variables.
As I mentioned the code is in fact creating the new worksheet in the
spreadsheet and inserting the first line (the headers/field names)
from the data table. So it seems to be able to recognise the table,
find the spreadsheet, create the new worksheet and insert the header
row, then give up and tell me it cannot find the table? There is some
400 records in the table it seems not to want to move. I have checked
references, and compacted the mbd. Bizarre!
I have reverted back to an older version of this front end and it is
working okay. (It has had several revisions of other reports etc
since, but not this particular one). It works okay.
From what I can find searching error 3011 I see references to corrupt
databases etc. I will copy/ recreate this report code into a new
module in a new mbd first and then bring it back in.
Cheers,
Piri
On May 7, 12:01 am, "Douglas J. Steele"
<NOSPAM_djsteele@NOSPAM_canada.com> wrote:
> As you're written it, I'm not surprised it won't work. The 3rd and 4th
> arguments (where you have [ReportData] and [ReportName]) are supposed to be
[quoted text clipped - 39 lines]
>
> > Piri
Alan - 13 May 2008 13:14 GMT
> Hello Doug,
> Thanks for the reply. Yes the arguments are variables.
[quoted text clipped - 68 lines]
>
> - Show quoted text -
Hope your method works. But if necessary, you can try a utility called
Advanced Access Repair to repair your Access MDB file. It works rather
well for my corrupt Access mdb files. Its web address is
http://www.datanumen.com/aar/
Alan
DubboPete - 13 May 2008 13:29 GMT
> > Hello Doug,
> > Thanks for the reply. Yes the arguments are variables.
[quoted text clipped - 76 lines]
>
> - Show quoted text -
Piri,
Are you just trying to create an updated version of a spreadsheet in a
specific location, or trying to create an updated worksheet within an
existing spreadsheet file?
If the first, your problem is a lot easier to understand and fix. If
the second, then perhaps others can help out better...
discuss
DubboPete