Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Operation must use an updateable query" error in MS Access

Tags:

ms-access

I am getting an error message: "Operation must use an updateable query" when I try to run my SQL. From my understanding, this happens when joins are used in update/delete queries in MS Access. However, I'm a little confused because I have another query almost identical in my database which works fine.

This is my troublesome query:

UPDATE [GS] INNER JOIN [Views] ON      ([Views].Hostname = [GS].Hostname)      AND ([GS].APPID = [Views].APPID)      SET          [GS].APPID = [Views].APPID,          [GS].[Name] = [Views].[Name],          [GS].Hostname = [Views].Hostname,          [GS].[Date] = [Views].[Date],          [GS].[Unit] = [Views].[Unit],          [GS].[Owner] = [Views].[Owner]; 

As I said before, I am confused because I have another query similar to this, which runs perfectly. This is that query:

UPDATE [Views] INNER JOIN [GS] ON  [Views].APPID = [GS].APPID  SET      [GS].APPID = [Views].APPID,      [GS].[Name] = [Views].[Name],      [GS].[Criticial?] = [Views].[Criticial?],      [GS].[Unit] = [Views].[Unit],      [GS].[Owner] = [Views].[Owner]; 

What is wrong with my first query? Why does the second query work when the first doesn't?

like image 693
Andrew Martin Avatar asked Nov 05 '13 13:11

Andrew Martin


People also ask

How do you fix operation must use an updateable query?

Look for the Security tab. If you can't see it, you need to go to My Computer, then click Tools and choose Folder Options.... then click the View tab. Scroll to the bottom and uncheck "Use simple file sharing (recommended)". Back to the Security tab, you need to add the relevant account to the Group or User Names box.

What is an updateable query in access?

You use update queries in Access databases to add, change, or delete the information in an existing record. You can think of update queries as a powerful form of the Find and Replace dialog box. You cannot use an update query to add new records to a database, or to delete records from a database.


2 Answers

There is no error in the code, but the error is thrown due to the following:

 - Please check whether you have given Read-write permission to MS-Access database file.  - The Database file where it is stored (say in Folder1) is read-only..?  

suppose you are stored the database (MS-Access file) in read only folder, while running your application the connection is not force-fully opened. Hence change the file permission / its containing folder permission like in C:\Program files all most all c drive files been set read-only so changing this permission solves this Problem.

like image 186
Mark Macneil Bikeio Avatar answered Oct 05 '22 21:10

Mark Macneil Bikeio


Whether this answer is universally true or not, I don't know, but I solved this by altering my query slightly.

Rather than joining a select query to a table and processing it, I changed the select query to create a temporary table. I then used that temporary table to the real table and it all worked perfectly.

like image 31
Andrew Martin Avatar answered Oct 05 '22 23:10

Andrew Martin