Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


View products that this article applies to.

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).

↑ Back to the top


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.

↑ Back to the top


Cause

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

↑ Back to the top


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.

↑ Back to the top


More information

Steps to Reproduce the Behavior

  1. On the Help menu, point to Sample Databases, and then click Northwind Sample Database.
  2. 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
    					

↑ Back to the top


References

For additional information about another cause of this error message, click the article number below to view the article in the Microsoft Knowledge Base:
295200� ACC2002: "Cannot Update. Database or Object Is Read-Only" Error When You Convert an Uncompiled, Read-only Database

↑ Back to the top


Keywords: KB304146, kbprb, kberrmsg, kbhowto

↑ Back to the top

Article Info
Article ID : 304146
Revision : 8
Created on : 1/31/2007
Published on : 1/31/2007
Exists online : False
Views : 303