Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2002
    Location
    London
    Posts
    73

    Unanswered: Runtime error 3027 Cannot update Database or Object is Read only

    Hi

    I'm having trouble with my database (MS Access 2000). I'm trying to export a file into a text file by clicking on a button. Below is the code. Where the code is in bold that is when the runtime error happens.

    If i export the code manually by right click on the query > Export then this works, but for some reason by clicking on the button will not work.

    Private Sub cmdExport_Click()
    Dim sExportFilePath As String
    sExportFilePath = DLookup("[DateExportLocation]", "tblSettings", "[ID]=1") ' Path if file to be exported
    DoCmd.OpenQuery "qryUpDateTransmissionDateAndTime", acViewNormal, acEdit ' Update dates time
    DoCmd.TransferText acExportDelim, "ExportFile", "qryExportFile", sExportFilePath
    End Sub


    I appreciate your help

  2. #2
    Join Date
    May 2004
    Posts
    159
    I was having this problem myself with the transfertext method and getting the same error. you might want to see my solution from this week.
    Basically I was trying to use transfertext into a file that did not have a .txt extenson. It doesn't allow that. I had to use the fso methods to rename the file after it had been exported.

  3. #3
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926

    Exporting

    Not sure if this might help but you can look at the code in the attachment and change the importing to exporting.
    Attached Files Attached Files
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •