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

Allow Edits query

Status
Not open for further replies.

VeeFour

Technical User
Nov 24, 2002
29
0
0
GB
How do I turn off Allow edits once data has been entered into a field so no more editing is possible?
 
You could set the controls enabled property to false Regards,
gkprogrammer
 
In the AfterUpdate event of the control containing the field which is your switch add the following:

Me.AllowEdits = False

This will turn off editing for the current form.

if you want to just turn off that field then you have to move the focus to another control then lock the first control

Me!nextcontrol.SetFocus
Me!firstcontrol.Locked = True

You might need to test the value because the first control will stay locked so:
In the Form_Current event

If Not IsNull(Me!firstcontrol) Then
Me!nextcontrol.SetFocus
Me!firstcontrol.Locked = True
Else
Me!firstcontrol.Locked = False
End If

Now if the control is empty when you open a new record you will be able to edit it. you can't unlock or lock a control whilst it has the focus so you have to move first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top