Hi, Does anybody know how to set a control whereby it can restrict users from editing the previous record line once entered, the particular column will be locked; no editing is allowed. But the next new record will be unlocked again for entry.
I tried to do myself but i have found an error when i edit previous row which is not ZERO . It stated runtime error 2166 "You can't lock a control while it has unsaved changes" Then, the following new entry which is auto-given ZERO can be unlock and work accordingly.
My code as like this :
Private Sub QTY_Change()
If "" & QTY <> 0 Then
QTY.Locked = True
If "" & QTY = 0 Then
QTY.Locked = False
End If
End If
End Sub
i did use event like BeforeUpdate or AfterUpdate or On_change instead ,but it failed somehow.
What could be that problem?
Thanks
I tried to do myself but i have found an error when i edit previous row which is not ZERO . It stated runtime error 2166 "You can't lock a control while it has unsaved changes" Then, the following new entry which is auto-given ZERO can be unlock and work accordingly.
My code as like this :
Private Sub QTY_Change()
If "" & QTY <> 0 Then
QTY.Locked = True
If "" & QTY = 0 Then
QTY.Locked = False
End If
End If
End Sub
i did use event like BeforeUpdate or AfterUpdate or On_change instead ,but it failed somehow.
What could be that problem?
Thanks