UPDATE table1 SET truefalsefield = -1 where key = 500; Never updates!

  • Thread starter Thread starter suica
  • Start date Start date
S

suica

MS Access 2003

UPDATE table1 SET truefalsefield = -1 where key = 500;

The field truefalsefield is never updated. It is a true/false (boolean)
field.
Whatever I do the field stays always empty. I tried to do as well:

UPDATE table1 SET truefalsefield = 1 where key = 500;
UPDATE table1 SET truefalsefield = Yes where key = 500;
UPDATE table1 SET truefalsefield = true where key = 500;

As well I did it with a sql-query in Access itself and via ODBC.
Nothing works.

I have other boolean fields in the same table which I can update. The
database was an Access 2.0 Database and was updated to Access 97 and
then to Access 2000 and finally to Access 2003.
Most of the boolean fields were already in the Access 2.0 database.
however one new boolean field is updatable and the other not. But I
cannot see any difference between these two.

Any ideas???

Thanks a lot.
Andreas
 
This should work.

What is the data type of the field named "key"?
If Text, you need extra quotes.

How many records have 500 as a value in the key field?
How many are returned from:
SELECT Table1.* WHERE key = 500;

How are you trying to execute this?
In query design, using Run?
Or in code?

If you have turned off SetWarnings, try turning it back on again so you can
see any error message.

Try:
dbEngine(0)(0).Execute "UPDATE table1 SET truefalsefield = true where
key = 500;", dbFailOnError
Debug.Print dbEngine(0)(0).RecordsAffected
 
Hi Allen

thanks for your response.
What is the data type of the field named "key"?
Number format. Long.
How many records have 500 as a value in the key field?
1 record.
How many are returned from:
SELECT Table1.* WHERE key = 500;
1 record.
How are you trying to execute this?
In query design, using Run?
Or in code?
In query design and in code (ODBC with Powerbuilder)
In Powerbuilder there is as well an sql-error code. But it is 0 after
the execution of the
query. So for Powerbuilder the update was successfull, however in the
Database did not
change anything...

If you have turned off SetWarnings, try turning it back on again so you can
see any error message.

Try:
dbEngine(0)(0).Execute "UPDATE table1 SET truefalsefield = true where
key = 500;", dbFailOnError
Debug.Print dbEngine(0)(0).RecordsAffected

Ok I will try that.
 
Back
Top