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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Locking a field after one entry 1

Status
Not open for further replies.

MikeMcKeown

Programmer
Apr 1, 2003
69
GB
Hi all,

i was just wondering if it was possible to prevent a user from editing a database field on a form. So they would be able to enter a value once and then they would be prevented from entering it again. i.e. locking the fields for edits

Thanks in advance
 
You need to add code to two places to do this:
Assume the textbox is called txtMyField then you add the following code to both the txtMyField afterupdate event procedure and the FormCurrent event procedure.

If not isnull(me.txtmyfield) then
me.txtmyfield.locked = true
else
me.txtmyfield.locked = false
end if

Obviously use your own textbox name.
 
I should have added that this protects enrtries as long as they are made through the one form. If you allow the field to be accessed from another form you need to do the samae there. If you allow direct access to the table then all bets are off!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top