Locking only one record

CEH

Curtis
Local time
Yesterday, 18:41
Joined
Oct 22, 2004
Messages
1,187
Seen several post on locking records, but haven't found anything on locking one individual record. Situation is this... Have a DB that has several dropdown boxes... This is a DB on employment... So for example... one table consist of three choices a "Shift" table... 1 is "No Preference", 2 is "Days" and 3 is "Nights" (The ID number is autonumber) The problem is this... I want to make this DB available to different users. Some may have "Day" or "Night" shifts, others may have, for example.."Morning", "Mid Day", "Night".... So I have added a "Setup" form to allow these changes to be made. My problem is record #1.. "No Preference" MUST remain ID #1. So to make a long story short.....well...shorter..:)... Is there a way to only lock record #1?
 
Use the OnCurrent event of your form to test for ID # 1, if current record is ID # 1, then lock that record, else record is not locked.

HTH
 
I went another way.... Someone who is one of our hot coders here correct me if this is wrong... But... I could not get this to work on the OnCurrent event of the form, locked all the records, nor did I think that it was needed on the oncurrent event... The only time this code needs to run is if someone tries to change the text in the "Day" field. To do that it has to have focus. So my code is such.........
Private Sub Day_GotFocus()
If Me.DayID = "1" Then
Me.Day.Locked = True
Else: Me.Day.Locked = False
End If

End Sub
This seems to work fine.... Will I run into any problems with this one? Is there a better method?
Thanks
 

Users who are viewing this thread

Back
Top Bottom