Smart questions
Smart answers
Smart people
Join Tek-Tips Forums
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Access 2003 to 2007: Run-time error '3027' Cannot update, Database or object is read-only

DBLoser (MIS) (OP)
14 Aug 12 16:10
I have a database that worked fine in Access 2003. Now that I'm using Access 2007, it gives a run-time 3027 error. It is breaking down on the DoCmd.TransferText line. I've tried this on multiple computers (XP, Win7) and the file is being saved to the C: drive and I have administrative privileges. The MBNAExportSpecification export spec does exist in the MSysIMEXSpecs table. I also did the old jet registry hack to add the .prn extension to the list of exports (worked fine in 2003). Here is the code:

CODE -->

Private Sub Export_Click()

    Dim TempFileName As String
    
    Me.Form![txtFileName].SetFocus
    TempFileName = txtFileName.Text
    DoCmd.TransferText acExportFixed, "MBNAExportSpecification", "ExportTable", TempFileName
    Me.Form![txtFileName].SetFocus
    MsgBox ("Successfully exported the file " & txtFileName.Text)
    Me.Form![txtFileName].SetFocus
    
End Sub

Private Sub Form_Load()

    Dim DateToFilename As String
    DateToFilename = "C:\" & Format(Date, "mmddyyyy")
    Me.Form![txtFileName].SetFocus
    txtFileName.Text = DateToFilename & ".prn"
        
End Sub 
genomon (Programmer)
14 Aug 12 17:01
Try adding the destination folder to the list of trusted locations, and enable all macros in the Trust Center settings.

Beir bua agus beannacht!

DBLoser (MIS) (OP)
14 Aug 12 17:04
Done. Same error.
genomon (Programmer)
14 Aug 12 17:08
If by any chance you haven't done this on Vista/Win7, you may need to manually take ownership of the folders (even if you are logged in as admin): http://technet.microsoft.com/en-us/library/cc75365...

Beir bua agus beannacht!

DBLoser (MIS) (OP)
14 Aug 12 17:08
I just tried changing the .prn to .txt and get a new error.

Run-time error '3011':
The Microsoft Office Access database engine could not find the object '08142012#txt'. Make sure the object exists and that you spell its name and the path name correctly.

When I mouse-over the variable TempFileName its value is c:\08142012.txt.
genomon (Programmer)
14 Aug 12 17:11
Odd. Found this, but may not help: http://www.programmersheaven.com/user/Manya757/blo...

Beir bua agus beannacht!

DBLoser (MIS) (OP)
14 Aug 12 17:15
I tried on an XP machine w/ Access 2007, same error. This should rule out the permissions/ownership issue.

I also suspected a corrupt database so I restored it from a backup. It works fine as Access 2000 and I can convert to Access 2003 and open fine in Access 2003. When I convert or open it with Access 2007 I get the error.
genomon (Programmer)
14 Aug 12 17:19
banghead Maybe try converting the 2000 version directly to 2007?

Beir bua agus beannacht!

DBLoser (MIS) (OP)
14 Aug 12 17:23
bugeyed Good suggestion but same with or without conversion.
genomon (Programmer)
14 Aug 12 17:29
ARRRRRGH. I'll take another look tomorrow if you haven't found any relief.

Beir bua agus beannacht!

DBLoser (MIS) (OP)
15 Aug 12 15:47
I got this working but had to change the export to My Documents, rather than C:\. Also, the registry hack to allow saving as a .prn extension doesn't work so I had to export as fixed text to a .txt file and then used the Name command to rename the file to .prn

CODE -->

Private Sub Export_Click()

    Dim TempFileName As String
    Dim oldFileName As String
    Dim newFileName As String
    Dim strDocuments As String
        
    Me.Form![txtFileName].SetFocus
    TempFileName = txtFileName.Text
    DoCmd.TransferText acExportFixed, "Fixed Width 90", "ExportTable", TempFileName
    Me.Form![txtFileName].SetFocus
    MsgBox ("Successfully exported the file " & txtFileName.Text)
    Me.Form![txtFileName].SetFocus
    Export.Enabled = False
    
    Set WshShell = CreateObject("WScript.Shell")
    strDocuments = WshShell.SpecialFolders("MyDocuments")
    
    oldFileName = strDocuments & "\" & TempFileName
    newFileName = strDocuments & "\" & Left(TempFileName, 8) & ".prn"
    
    Name oldFileName As newFileName
    
End Sub

Private Sub Form_Load()

    Dim DateToFilename As String
    DateToFilename = Format(Date, "mmddyyyy")
    Me.Form![txtFileName].SetFocus
    txtFileName.Text = DateToFilename & ".txt"
    Command0.Enabled = True
    Export.Enabled = False
        
End Sub 

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close