reference the correct button when selecting a record

rwahdan

New member
Local time
Today, 02:46
Joined
Feb 11, 2006
Messages
9
I have a continuous form that includes all records in one form. I added a button called "Edit" for each record and when clicked it changes its caption to "Update". Currently it is changing the caption of that button for all records to "Update". How to make it only change the caption of only the selected record and disable the rest of the buttons for other records.

Thanks.
 

Attachments

  • sample.png
    sample.png
    20.7 KB · Views: 139
Do you have something in the record itself that could be referenced?

If you had a field that indicated "Being Edited" that would ONLY be set for those records users are editing, then you could use conditional logic to set the button.

With continuous forms the ONLY way to make "Per record" changes (such as captions, colors, ect..) is if there is something unique to THAT RECORD you can reference. Otherwise you get the issue you describe.
 
If you want to use the Edit button to change the "Allow Edits" property, that's fine but don't change the caption. As you can see, all rows change in sync because buttons are not bound. Access keeps only one isntance of properties for a subform so when you see multiple rows, all unbound objects will have the same value.

Don't worry that everything will be unlocked. You just need to lock the record in the Form's Current event. Remember - only ONE record is the current record. and only ONE record can be updated at one time so even though technically when you unlock the form , ALL records are unlocked, you can't have focus in multiple rows so in reality, only the current record is updateable.

To recap:
In the form's Current event:

Me.AllowEdits = False

In the click event of the Edit button:

Me.AllowEdits = True
 

Users who are viewing this thread

Back
Top Bottom