Cannot update. Database or object may be read-only (1 Viewer)

ailinglew

New member
Local time
Today, 00:57
Joined
Dec 6, 2009
Messages
6
Hi All,

I have recently converted a database from Access 97 to Access 2007 which used the TransferText command.

DoCmd.TransferText acExportDelim, "Testing Export Specification", "Testing", "C:\Testing" & "." & Format(Now(), "yymmddhh") & "08"
- which worked fine.


However, when I try to run this line of code in Access 2007 I get a message "Cannot update. Database or object may be read-only".

Anybody know how to make this work?

Thank you.

 

ailinglew

New member
Local time
Today, 00:57
Joined
Dec 6, 2009
Messages
6
Thanks for your reply.

Yes, in Trusted Location.
I would like to check with you, is that possible to generate output file as Testing.yymmddhh08 (eg: Testing.0912080108) in Access 2007?
Actually the same coding use for Access 97 and it is working fine. The error happened after converted into Access 2007.
May i know is that Access 2007 does not support for this file type?

Thank you.
 

boblarson

Smeghead
Local time
Today, 00:57
Joined
Jan 12, 2001
Messages
32,059
What about the file extension? I think you're missing the extension (.txt or .csv, .xls, etc).
 

ailinglew

New member
Local time
Today, 00:57
Joined
Dec 6, 2009
Messages
6
Hi boblarson,

This is the output file "Testing.0912080108" that the Access application need to be generated.
We are using Access 97 to generate output file with this file type ".yymmddhh08" for a few years. Recently my company want to upgrade to Access 2007 and i found the error after converted to Access 2007.
May i know is that Access 2007 does not support for this file type?

Thank you.
 

ailinglew

New member
Local time
Today, 00:57
Joined
Dec 6, 2009
Messages
6
Hi All,

Could anyone tell me that Access 2007 able to create this kind of file (eg:Testing.0912080108)? If it is cannot, then i need to think other solution.

Thank you.
 

RuralGuy

AWF VIP
Local time
Today, 01:57
Joined
Jul 2, 2005
Messages
13,826
Can't you just create a Foo() function in a standard module that create a test file to see if Access will do it? Then call it from the immediate window.
 

ailinglew

New member
Local time
Today, 00:57
Joined
Dec 6, 2009
Messages
6
I've tried to create a simple module to generate output file (eg: Testing.1234) from a table. I get an error and highlighted on statement below when debugging.

DoCmd.TransferText acExportDelim, "", "Testing", "C:\Testing.1234"

Error:
Run-time error '3027':
Cannot update. Database or object is read-only.
 
Last edited:

RuralGuy

AWF VIP
Local time
Today, 01:57
Joined
Jul 2, 2005
Messages
13,826
I've done enough testing to know that error is not being caused by the output filename. Access does not like something else in the syntax.
 

boblarson

Smeghead
Local time
Today, 00:57
Joined
Jan 12, 2001
Messages
32,059
One thing - do NOT use "" for the export spec name. If you have an export spec, great. If not, do not put anything there:

DoCmd.TransferText acExportDelim, , "Testing", "C:\Testing.1234"
 

RuralGuy

AWF VIP
Local time
Today, 01:57
Joined
Jul 2, 2005
Messages
13,826
That's the first thing I did Bob and still have the same error.
 

boblarson

Smeghead
Local time
Today, 00:57
Joined
Jan 12, 2001
Messages
32,059
I've done enough testing to know that error is not being caused by the output filename. Access does not like something else in the syntax.

Well, if I change the file name to .txt instead of .1234 it works. So, it would seem that it doesn't like that extension.
 

boblarson

Smeghead
Local time
Today, 00:57
Joined
Jan 12, 2001
Messages
32,059
However, THIS does work:

Code:
DoCmd.TransferText acExportDelim, , "Testing", "C:\Testing.txt"
Name "C:\Testing.txt" As "C:\Testing.1234"
 

RuralGuy

AWF VIP
Local time
Today, 01:57
Joined
Jul 2, 2005
Messages
13,826
Darn, I tried .123 instead of .1234 but didn't try .txt. Good catch Bob.
 

RuralGuy

AWF VIP
Local time
Today, 01:57
Joined
Jul 2, 2005
Messages
13,826
I just tried it with Testing.12345678 without any problem. I believe that is the OP's solution.
 

ailinglew

New member
Local time
Today, 00:57
Joined
Dec 6, 2009
Messages
6
Hi RuralGuy,

Could i have your code to generate Testing.12345678 without any error?
Thank you.
 

RuralGuy

AWF VIP
Local time
Today, 01:57
Joined
Jul 2, 2005
Messages
13,826
It is just Bob's code with more characters in the extent of the filename.
Code:
DoCmd.TransferText acExportDelim, , "Testing", "C:\Testing.txt"
Name "C:\Testing.txt" As "C:\Testing.12345678"
 

Users who are viewing this thread

Top Bottom