1

This question has been asked many times, my case seems to be the simplest, still I did not find the answer to my question...

The environment is Windows, Access 2013. Table tbl_rap is linked, resides on MS SQL Server 2007

Table tbl_rap is constructed as follows:

id - int (Identity)
field_1 nchar(10)
field_2 nchar(1)

The following code works

sql_cmd = "INSERT INTO tbl_rap (field_1,field_2) VALUES ('010308HB3','R')"
DoCmd.RunSQL sql_cmd

But this code

sql_cmd = "UPDATE tbl_rap SET field_2 = 'X' WHERE field_1 = '010308HB3'"
DoCmd.RunSQL sql_cmd

fails with run-time error 3037 "Operation must use an updateable query"

Any help would be appreciated.

braX
  • 11,506
  • 5
  • 20
  • 33
RAP
  • 11
  • 1
  • This is very much like [this previous question](https://stackoverflow.com/questions/19789709/operation-must-use-an-updateable-query-error-in-ms-access), but only one of the answers looks appropriate to me. Try `UPDATE DISTINCTROW` instead of just `UPDATE`. – Laughing Vergil Jul 17 '19 at 16:28
  • 1
    I tried before I posted this. – RAP Jul 17 '19 at 16:43

1 Answers1

0

As you use nchar(10), you must pass a string of 10 characters, say:

sql_cmd = "UPDATE tbl_rap SET field_2 = 'X' WHERE field_1 = '010308HB3 '"
Gustav
  • 53,498
  • 7
  • 29
  • 55