preventing changes to one field on an existing record

  • Thread starter Thread starter lynne
  • Start date Start date
L

lynne

I have a form for a table that tracks employee payroll
deductions. One field on the record, the employee number,
CAN change under some unusual circumstances but shouldn't
ordinarily. The other fields on the record can change
anytime. How can I give them a warning message if they
are about to change a existing employee number, let them
change it if they really mean to or cancel, and still let
them enter new records or change other fields on existing
records?

TIA
 
There are two options that I can think of.

1. Given that it is unusual to change employee numbers,
you could consider making a separate form just for that
purpose and restricting access to it to only certain users.
Then on the existing form, you could set its Locked
property to Yes.
2. If you wish to keep it as updateable on the existing
form, then you could put code in the employeenumbercontrol
AfterUpdate eventhandler along the following lines

If Msgbox ("Are You Sure That You Want to Change The
Employee Number", vbYesNo) = vbNo Then
{employeeNumberControl}.Value =
{employeeNumberControl}.OldValue
End If

You will have to change {employeeNumberControl} including
{} with your own control name.

Hope This Helps
Gerald Stanley MCSD
 
Back
Top