Consulting

Results 1 to 2 of 2

Thread: Database or object is read-only

  1. #1
    VBAX Master paulked's Avatar
    Joined
    Apr 2006
    Posts
    1,007
    Location

    Database or object is read-only

    Hi

    I keep getting an error "Cannot update. Database or object is read-only." on the INSERT INTO Goods... line in the code below:

    Sub Goods2DB()
        RstLog
        On Error GoTo Oops
        frmWriting.Show
        frmWriting.BackColor = Sett.Cells(1, 2)
        DoEvents
        With CreateObject("ADODB.Connection")
            .Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=K:\KKDB.accdb;"
            .Execute "INSERT INTO TestOpen (TestField) VALUES ('" & Sett.Cells(42, 2) & "') "
            .Execute "delete from Goods"
            .Execute "insert into Goods SELECT * FROM [Excel 8.0;HDR=YES;DATABASE=" & ThisWorkbook.Name & "].[DBGoods$]"
        End With
        Unload frmWriting
    Xit:
        Exit Sub
    Oops:
        strErrSource = Err.Source
        strErrDesc = Err.Description
        strErrDetail = "The Goods list has not been updated, please try again."
        frmOops.Show
        Logger "Err: Goods2DB", Err.Source, Err.Description
        Unload frmWriting
    End Sub
    It executes the INSERT INTO TestOpen and the deletes the contents of the Goods table and then errors. If it was able to delete the contents, why can't it write them?

    I'm totally flummoxed and have been Googling for hours (tried all sorts but no luck!)

    Any help would be gratefully received!

    Thanks, Paul Ked
    Semper in excretia sumus; solum profundum variat.

  2. #2
    VBAX Master paulked's Avatar
    Joined
    Apr 2006
    Posts
    1,007
    Location
    It stopped doing it and works now! No re-boot or other changes!
    Semper in excretia sumus; solum profundum variat.

Posting Permissions

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