[Microsoft][ODBC Microsoft Access Driver] Cannot update. Database or object is read-only.

I am trying to update a few fields from the following code and get the above error.  I am the only person accessing the database.  Using access 2007 and visual studio 2012

   rec.Open(strsql, cn, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic)

        With rec
            .Fields("Sdate").Value = Sdate
            .Fields("timeVal").Value = Time
            .Fields("notes").Value = notes
            .Fields("overtime").Value = Overtime
        End With
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Make sure you have full privs for the directory where the DB resides (read, write, and delete).   You should see an .LDB file created when you connect to it.

Maybe I'm way off here, but isn't a call to Edit() required before you change the field values and do the Update()?
Jeffrey CoachmanMIS LiasonCommented:
I though that too,
...but it looks like ADO code, so .edit is not needed....
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Jeffrey CoachmanMIS LiasonCommented:

Can you post the entire code?

Code similar to this works fine for me...

Dim cnn As ADODB.Connection
Dim rec As ADODB.Recordset

Set cnn = CurrentProject.AccessConnection

Set rec = New ADODB.Recordset
With rec
    Set .ActiveConnection = cnn
    .Source = "table1"
    .LockType = adLockOptimistic
    .CursorType = adOpenKeyset
    .Fields("FirstName").Value = "John"
    .Fields("LastName").Value = "Smith"
End With

Set rec = Nothing
Set cnn = Nothing

BROOKLYN1950Author Commented:
I figured it out. I was using the WHERE statement to join two tables instead of using an actual JOIN statement. Once I started to use JOIN instead everything worked.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BROOKLYN1950Author Commented:
I figured out the problem myself
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.