Update records through a subform
Posted on 2016-11-04
I have a subform whose record source is a table (MyTable). The subform’s data is displayed as continuous forms.
In the detail section of the subform I have a command button. To the right of the button are textboxes which are used to display values from the various fields in MyTable.
So, when the subform is in Form View, the records from MyTable are displayed (one row for each record) and there is a command button next to each record
What I’m trying to accomplish is to run an update query that will update MyTable but only update the record next to the particular command button I click. Right now, it seems to be updating ALL records in MyTable.
The update I’m trying to perform is to just set at YES/NO field (Field1) from No to Yes but only for the selected record.
Here is the update query as it is now (that is affecting the entire table, not just the target record):
UPDATE MyTable SET Field1 = -1;
I also tried this but it doesn't seem to be working either (ID is the primary key):
UPDATE MyTable SET Field1 = -1