Update query not applying

BBrian

New member
Local time
Today, 13:55
Joined
Oct 15, 2010
Messages
5
I writing a script outside Access to remove table locks that aren't cleanly removed when I reboot the server the database is on without remembering its in use (or when the power goes). I'm writing it using AutoIt and have two delete queries executing nicely, but the update query I also need fails.

I'm using access 2007 and a .mdb file. I went into Access and created the query:
Code:
UPDATE LOCKS SET LOCKS.Locked = "N"
WHERE LOCKS.Locked = "Y"
And under the design tab on the ribbon, I hit "Run", but nothing gets changed. I figure the query is correct because Access wrote it for me but I'm lost as to why it's not affecting the rows. No error message is given.
 
Try;
Code:
UPDATE LOCKS SET LOCKS.Locked = No
WHERE (((LOCKS.Locked )=Yes));
 
Try;
Code:
UPDATE LOCKS SET LOCKS.Locked = No
WHERE (((LOCKS.Locked )=Yes));

Excuse me, that's closer to the code Access created. I then took out the brackets in a debug attempt (to bring it closer to SQL I'm familiar with). The Data Types are all text, so I changed that to "N" and "Y", but nothing changes in the Locks table.

Then I noticed in the status bar "The action or event has been blocked by Disabled Mode". Sorted that, but the AutoIt script is still giving me an error.

I've shortened the query to:
Code:
UPDATE LOCKS SET LOCKS.Locked = "N"
This should be OK on <1500 rows on a 0.5gb database, right?

I'll search the AutoIt forums for a while. Though it's 4.30pm on Friday here. Thanks for the quick reply!
 
Ah sorry I assumed you where dealing with a Yes/No field rather than a text field :o

Have you tired setting your query as a select query to ensure that it is collecting all the records you expect? Once you are satisfied that that is working correctly change it to an update query.
 

Users who are viewing this thread

Back
Top Bottom