Microsoft KB Archive/304146

= You may receive a &quot;Cannot update. Database or object is read-only&quot; error message when you use the TransferSpreadsheet action =

Article ID: 304146

Article Last Modified on 1/31/2007

-

APPLIES TO


 * Microsoft Office Access 2003
 * Microsoft Access 2002 Standard Edition

-



This article was previously published under Q304146



Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).



SYMPTOMS
When you run a macro that uses the TransferSpreadsheet action to export a table or query to the Microsoft Excel file format, you receive the following error message:

Cannot update. Database or object is read-only.



CAUSE
This error message occurs when one of the following conditions is true:
 * The file name is surrounded with quotation marks, for example &quot;C:\Employees.xls&quot;.
 * A carriage return/line feed (CTRL+ENTER) is at the end of the file name in the FileName property.



RESOLUTION
To avoid this error message, when you set the FileName property, insert only the path to the file that you want to export. Do not surround the path with quotation marks or end the line with a carriage return/line feed.



Steps to Reproduce the Behavior
 On the Help menu, point to Sample Databases, and then click Northwind Sample Database.  Create a new macro called TestOutput as follows:   Action: Transferspreadsheet Transfer Type: Export Spreadsheet Type: Microsoft Excel 8-10 Table Name: Employees File Name: C:\Employees.xls (insert a carriage return/line feed at the              end of this line by pressing CTRL+ENTER) Has field names: No                   

