Hi!
First some background info.
I have an application for employee administration. I only use unbound controls on the main form. These controls get their data from a record set via vb code.
Then they can look at the data and changed it if they want, but it is first when they hit the button “save” that the changes get saved to the record.
These works just fine. But the problem arises when there is more than one user editing the some record the some time.
[ul]For example: User A is looking at employee 161 and
needs to check some information.
[ul]The record: Employee 161, name Markus Larsson, phone
number 168108, email markus.larsson@momenta.se[/ul]
Some time later user B takes a look at employee 161 and changes the phone number. (Saving the record.)
[ul]The record: Employee 161, name Markus Larsson, phone
number 160010, email markus.larsson@momenta.se[/ul]
Now user A gets back and shall change the email. But when he saves the record he also saves the old phone number.
[ul]The record:Employee 161, name Markus Larsson, phone
number 168108, email markus@momenta.se[/ul]
[/ul]
So user A is undoing the changes that user B has done.
I have been thinking on some possible solutions to this problem without using bound controls. And the best solution (that I can think of) is to lock the record for a small amount of time, 2 minutes, after that the user cannot save the record.
But how do I lock the record?
Can I do it in code?
I have tried with a bound control on the form but the record only gets locked when that control is getting edited, not always.
Any suggestions are welcome, Larsson
First some background info.
I have an application for employee administration. I only use unbound controls on the main form. These controls get their data from a record set via vb code.
Then they can look at the data and changed it if they want, but it is first when they hit the button “save” that the changes get saved to the record.
These works just fine. But the problem arises when there is more than one user editing the some record the some time.
[ul]For example: User A is looking at employee 161 and
needs to check some information.
[ul]The record: Employee 161, name Markus Larsson, phone
number 168108, email markus.larsson@momenta.se[/ul]
Some time later user B takes a look at employee 161 and changes the phone number. (Saving the record.)
[ul]The record: Employee 161, name Markus Larsson, phone
number 160010, email markus.larsson@momenta.se[/ul]
Now user A gets back and shall change the email. But when he saves the record he also saves the old phone number.
[ul]The record:Employee 161, name Markus Larsson, phone
number 168108, email markus@momenta.se[/ul]
[/ul]
So user A is undoing the changes that user B has done.
I have been thinking on some possible solutions to this problem without using bound controls. And the best solution (that I can think of) is to lock the record for a small amount of time, 2 minutes, after that the user cannot save the record.
But how do I lock the record?
Can I do it in code?
I have tried with a bound control on the form but the record only gets locked when that control is getting edited, not always.
Any suggestions are welcome, Larsson