View Full Version : Disable Record in Form


Haytham
01-29-2002, 01:18 PM
Hi All...
I have a tabular form, shows names of users with their passwords.
If UserName in any record is Admin, I want to disable this record only while other records remain enabled.
I tried:

If Me.UserName = "Admin" Then
Me.UserName.Enable = False
Else
.....
End If

But it disabled all the UserNames for all the records.
Is it possible to disable one record only in a tabular form..

Many thanks

jwindon
01-29-2002, 02:14 PM
Try this Haytham:

Private Sub Form_Current()

' code is fired on the OnCurrent event of the form
'as user moves record to record


If Me.LenKey = 19 Then
Me.LLastName.Enabled = False
Me.LFirstName.Enabled = False

' etc.

Else
Me.LLastName.Enabled = True
Me.LFirstName.Enabled = True
' etc.

End If

End Sub

Couldn't find a way to lock the whole record, but this will get the job done. You need to consider renaming UserName for this field as it is is one of those reserved names I believe.

[This message has been edited by jwindon (edited 01-29-2002).]

Haytham
01-30-2002, 01:54 PM
True jwindon. This will do the job.
Thanks a lot.