Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

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

Status
Not open for further replies.

DBLoser

MIS
Apr 7, 2004
92
US
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
 
Try adding the destination folder to the list of trusted locations, and enable all macros in the Trust Center settings.

Beir bua agus beannacht!
 
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.
 
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.
 
[banghead] Maybe try converting the 2000 version directly to 2007?

Beir bua agus beannacht!
 
[bugeyed] Good suggestion but same with or without conversion.
 
ARRRRRGH. I'll take another look tomorrow if you haven't found any relief.

Beir bua agus beannacht!
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top