SteveL13
asked on
How can I save the record when a checkbox is either checked or unchecked?
I have a form with several checkboxes. How can I save the record when a checkbox is either checked or unchecked?
ASKER
When they are either checked if they were unchecked OR unchecked if they were checked.
ASKER
The reason for this is the user can have two forms open at a time and the change has to be reflected in the form other than the one the change was made in. Make sense?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Do I need to put they code in every AfterUpdate event of every checkbox? There are 40 of them.
You can change it to one little subfunction which you then call with one line of code from each checkbox.
However, the clever method is to use WithEvents. It takes a little to get into, but once settled, it is plain easy to implement.
You can study my article:
Create Windows Phone Colour Palette and Selector using WithEvents
for a very similar example (using the click event of a label).
This will demand zero code to be typed for each checkbox.
However, the clever method is to use WithEvents. It takes a little to get into, but once settled, it is plain easy to implement.
You can study my article:
Create Windows Phone Colour Palette and Selector using WithEvents
for a very similar example (using the click event of a label).
This will demand zero code to be typed for each checkbox.
If you're using a bound form, Access is going to save the record whether you've checked the box or not, assuming you've dirtied the record. Gustav's suggestion would immediately save the record.
In order for the change to be reflected, the "other" form would have to requery/refresh the datasource for the form. You could do that from the first form, but that could cause issues with the "other" form - for example, if the user there has made changes, those changes may not be saved.
In order for the change to be reflected, the "other" form would have to requery/refresh the datasource for the form. You could do that from the first form, but that could cause issues with the "other" form - for example, if the user there has made changes, those changes may not be saved.
Jim.