Re: DoCmd.TransferSpreadsheet acExport, problem
- From: Piri <wiremu.pareiha@xxxxxxxxxxx>
- Date: Tue, 6 May 2008 13:11:12 -0700 (PDT)
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 corruptdatabases etc. I will copy/ recreate this report code into a new
module in a new mbd first and then bring it back in.
On May 7, 12:01 am, "Douglas J. Steele"
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
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.
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no e-mails, please!)
"Piri" <wiremu.pare...@xxxxxxxxxxx> wrote in message
I am using the following to transfer the contents of a table into an
existing spreadsheet (as a new worksheet).
This has worked for me previously.
DoCmd.TransferSpreadsheet acExport, 8, [ReportData], [ReportName]
where ReportData is the linked table name in the local database and
ReportName is the full path and file name of the spreadsheet.
I am getting Error "3011 - The Microsoft Jet database engine could not
find the object 'ReportData'. Make sure the object exists and that you
spell its name and the path name correctly."
The table does exist - the irony is that the worksheet is created in
the spreadsheet but only the field names from the table appear but no
other data? The data definitely exists in the table.
Why would it create the worksheet with the first line only of the
access table, and not include the rest of the data?
Am I doing anything wrong?