Avatar of Laurence Martin
Laurence Martin
Flag for United Kingdom of Great Britain and Northern Ireland

asked on 

VBA Query won't Edit

Can someone point out why this code crashes at the .Edit saying  that the database or query is read-only?

The code is set in an Access 2010 front-end linked to a SQL Server database.

The Access file is not read only - lots of similar procedures run OK.

The dataset the query produces is updateable - i can open it manually and change the DistributeOrderCard field.



Sub TestCust()
Dim db As Database
Dim recust As Recordset

Set db = CurrentDb()

'open customers
    Set recCust = db.OpenRecordset("qry101DistNewOrderCards", dbOpenDynaset, dbSeeChanges)
'test
    recCust.Edit
    recCust![DistributeOrderCard] = False
    recCust.Update
End Sub
VBAMicrosoft Access

Avatar of undefined
Last Comment
Laurence Martin

8/22/2022 - Mon