Solved

Cannot update. Database or object is read-only.- Error

Posted on 2008-06-15
15
3,642 Views
Last Modified: 2013-11-27
Using Access 2007 I am trying to create a csv file on my hard drive via an automated export.

The command line is:
DoCmd.TransferText acExportDelim, "product_master Export Specification", "5000-0 product_master", "L:\Ross ERP\FileUploads\Automated\product_master", True

I get the error "Cannot update. Database or object is read-only."

I definitely have permission to write to the drive

Can anyone tell me what I have done wrong
0
Comment
Question by:Zarbs
  • 8
  • 6
15 Comments
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 21789952
I read this in Helen Feddma's "Access Watch" newlsetter. Whilst I have some code that does work, I don't tend to export files in any 2007 systems (yet)

Q&A
Changes in Import/Export specifications in Access 2007
Q:  Fred Kerr writes that code for importing data from text files that worked fine in Access 2003 doesn't work in Access 2007.  Why?

A:  If you are using a saved Import spec, it won't work in Access 2007.  There was a significant change in Importing/Exporting in Access 2007; import/export specs are now saved in a system table, and are not available for use in code.  You can create and save specs in Access 2007, but they can't be used in code, only in the interface (why Microsoft did this is beyond me!).  Here is what I say in my Chapter 10 of my new book:

Unfortunately, Access 2007 VBA code doesnt recognize saved specifications. This feature worked for several previous versions, but at present it is broken, so we must wait for a patch or service pack to fix it. For now, only code that avoids using specifications will work.  (You can import from, or export to, a comma-delimited file without a specification, but not a fixedwidth file.)

However, you there are several other options for working with text files; you may be able to use components of the FileSystemObject, ADO code or legacy VB statements for importing data from (or exporting data to) text files.  These topics are covered in Chapter 9 of my new book, Access" 2007 VBA Bible For Data-Centric Microsoft Applications.  
0
 

Author Comment

by:Zarbs
ID: 21789975
Doesn't sound very promising to me.  Damn

Do you have any idea how I can export to a comma-delimited file without a specification?
0
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 21789988
Firstly I check my using the manual export functionality from the ribbon bar to ensure all works that way and that there's not another problem, then try the export leaving the specification blank (I think it's optional). You'll end up with the deafult settings for days, fields etc.
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 21790000
0
 

Author Comment

by:Zarbs
ID: 21790009
The export runs correctly from ribbon bar.

Still same error from module

I'll try the SP
0
 

Author Comment

by:Zarbs
ID: 21790019
Just discovered I am currently on SP1

ver 12.0.6213.1000
0
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 21790025
I don't see this fix in the list of fixes for SP 1.

Did you leave the spec out of the VBA version

i.e.
DoCmd.TransferText acExportDelim, ,"5000-0 product_master", "L:\Ross ERP\FileUploads\Automated\product_master", True
0
 

Author Comment

by:Zarbs
ID: 21790033
The amended command is:

DoCmd.TransferText acExportDelim, , "5000-0 product_master", "L:\Ross ERP\FileUploads\Automated\product_master", True

Still same error.  
0
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 21790037
Try creating a macro for the export (is based on the ribbon bar version). Seems like 2007 is heading back down the macro path.
0
 

Author Comment

by:Zarbs
ID: 21790144
There just doesn't seem to be any way of creating a csv (or at least the definition)

Seemed to run at least .... but looked like a report

Any ideas
0
 

Author Comment

by:Zarbs
ID: 21790162
This is using the "OutputTo" macro command

There isn't the equivalent of "ExportTo"
0
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 21790180
You can create a "saved Export" to a text file which seems to be the new "specification". You just need a way to run that from code or a macro. I'm a bit tied up to follow that further at the moment.
0
 

Author Comment

by:Zarbs
ID: 21790182
Thanks anyway
0
 

Author Comment

by:Zarbs
ID: 21790236
This seems to work:

DoCmd.TransferText acExportDelim, ,"5000-0 product_master", "L:\Ross ERP\FileUploads\Automated\product_master.csv", True

I added the csv bit
0
 
LVL 22

Accepted Solution

by:
Kelvin Sparks earned 500 total points
ID: 21790238
So obvious when you see it!!

Glad to help a fellow Kiwi
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Insert Into syntax error 10 29
Strategy for Reporting Crosstab Query w/ Changing Column Headings 12 40
ERROR 3113 MODULEID NOT UPDATABLE 8 18
query sort by digit 5 8
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question