Android Question How to update checkbox (true/false) automatically in database?

asales

Expert
Licensed User
Longtime User
In my project I try to update the field "Purchased" (boolean) in database when user clicks in checkbox but did not work.

When I check to true or false, change the record (prior / next) and return to the record updated, the checkbox not recognized the update.

How I can update the checkbox and the field when I click it.

My project with this problem is in attached.

Thanks in advance to who can help me.
 

Attachments

  • dbmovies.zip
    8.1 KB · Views: 174

Mahares

Expert
Licensed User
Longtime User
You did not include the database file 'movies.s3db' in the files folder for forum users to test your code.
Also, always declare:
Dim Sql1 As SQL 'in Process_Globals not in Globals
 
Upvote 0

asales

Expert
Licensed User
Longtime User
Hi Mahares.

The new file attached with "movies.s3db" database.

I declared Sql1 in Globals but the change of checkbox is not update automatically in database.
 

Attachments

  • dbmovies.zip
    8.8 KB · Views: 174
Upvote 0

Mahares

Expert
Licensed User
Longtime User
When the records are sorted by title, the displayed record is not updated because the ‘id’ column in the table does not match RecIndex which is the position of the record in the table. For example, Manhattan is record number 5 but its id is 7. I think you need to sort the records by id not title so that when they are being displayed on the screen one at a time, they are displayed by ascending ‘id’ instead of title.
You still have to adjust the code for the fact that the positions of the records are 0 to 9, but the id’s vary from 1 to 10
 
Upvote 0
Top