Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HOWTO: Lock a field in a form based on criteria?? 1

Status
Not open for further replies.

JesseM3

Programmer
Nov 2, 2002
4
US
I want users to be able to only add a new entry using a form, not edit current ones -- but I still want them to be able to scroll through the current entries. Is there a way I can do this? Some kind of expression that says something like "this field is locked unless blah blah blah" ..

Help!

Thanks.
 
Have a go with this. This code needs a label on the form called "lblEditMode"...

--------
Private Sub Form_Current()
If Me.NewRecord Then
Me.lblEditMode.Caption = ""
Me.AllowDeletions = True
Me.AllowEdits = True

Else
Me.lblEditMode.Caption = "this field is locked unless blah blah blah"
Me.AllowDeletions = False
Me.AllowEdits = False

End If

End Sub
-----------

Hope this helps
DanJR
 
Works perfectly! Thank you so much. You saved me a huge headache.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top