Locking Fields (1 Viewer)

vcarrill

Registered User.
Local time
Today, 01:59
Joined
Aug 22, 2019
Messages
60
Question:

I have a field called "PartID" which has exclusive information. I need this field to be locked, and accessible only when entering a new PartID, then locked afterwards.

Is there a way to do this?

Thank you!
 

theDBguy

I’m here to help
Staff member
Local time
Today, 00:59
Joined
Oct 29, 2018
Messages
21,358
If you're using forms, there is a Locked property you can use. You can also use Conditional Formatting for this.
 

vcarrill

Registered User.
Local time
Today, 01:59
Joined
Aug 22, 2019
Messages
60
"Locked property you can use." - I locked the field. How do I unlock it to add a new partid? Other than access the property sheet and manually unlocking it then locking it again?

You can also use Conditional Formatting for this. - What would I enter here?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 00:59
Joined
Oct 29, 2018
Messages
21,358
"Locked property you can use." - I locked the field. How do I unlock it to add a new partid? Other than access the property sheet and manually unlocking it then locking it again?

You can also use Conditional Formatting for this. - What would I enter here?

Hi. For conditional formatting, try

Value is: Not Null

Sent from phone...
 
Last edited:

vcarrill

Registered User.
Local time
Today, 01:59
Joined
Aug 22, 2019
Messages
60
Could something like this work?

If Me.NewRecord Then
Me.Part ID.Locked = False
Else
Me.Part ID.Locked = True
End If
 

theDBguy

I’m here to help
Staff member
Local time
Today, 00:59
Joined
Oct 29, 2018
Messages
21,358
Could something like this work?

If Me.NewRecord Then
Me.Part ID.Locked = False
Else
Me.Part ID.Locked = True
End If

Yes, if you put it in the Form's Current event.

PS. By the way, if your field's name has a space, you'll have to enclose it in square brackets.
 

Mark_

Longboard on the internet
Local time
Today, 00:59
Joined
Sep 12, 2017
Messages
2,111
Just to make sure, this is also a REQUIRED field for the form? Hate to have someone put in all the data but not the part ID, then find they can't enter it.
 

Micron

AWF VIP
Local time
Today, 03:59
Joined
Oct 20, 2018
Messages
3,476
If in form current event the test is for content (i.e. Null or "") then you don't have to check for new record:

Code:
If Nz(Me.[Part ID],"") = "" Then
 Me.[Part ID].Locked = False
Else
   Me.[Part ID].Locked = True
End If
 

Users who are viewing this thread

Top Bottom