Locking txt field after saved

avenger619

Registered User.
Local time
Today, 09:51
Joined
Jan 2, 2013
Messages
49
Hi guys,

I was wondering what would be the best way to automatically lock a txt field after data entry and only after form has been closed or moved to a new record and saved.

for example my key field for all my forms, quaries goes by "Applicant" I would like to lock this so users cant tamper with the name afterwards its been saved.

but nevertheless, would like to have the ability to unlocked if a correction needs to be made, or would corrections be made manually on the table directly?
 
Try the following in your Forms' On Current event;
Code:
Me.YourFieldName.Locked = Not Me.[URL="http://office.microsoft.com/en-au/access-help/newrecord-property-HA001232762.aspx"]NewRecord[/URL]
 
In addition to the locking code, you'll need code in the click event of a button to unlock the field.
Me.YourFieldName.Locked = False
 
RESOLVED>
Pat and John thanks soooo much this combination works magnificently!:D
 
Hi, I've tried this code but I'm trying to make it so that one button is for Locking the data, and the other is for Unlocking it.

But when I try to click my Lock or Unlock button, it says 'Invalid Qualifier'. Any help?
My code for the button is:

Code:
Private Sub Lock_Click()

Me.Name.Locked = Not Me.NewRecord
etc

End Sub

Private Sub Unlock_Click()
Me.Name.Locked = False
etc

End Sub
 
Try;
Code:
Private Sub Lock_Click()

Me.Name.Locked = [B][COLOR="Magenta"]True[/COLOR][/B]
etc

End Sub

Private Sub Unlock_Click()
Me.Name.Locked = False
etc

End Sub
 
Hmm tried that and got the same thing


Annoying..
After I click OK it also highlights the
Code:
Private Sub Lock_Click()
in yellow.

Is it something to do with my naming of 'Name'? Since it's selected?
 

Attachments

  • Error.JPG
    Error.JPG
    61.8 KB · Views: 89
Don't know why i didn't notice before but Name is a reserved word :banghead:

Change the field name or enclose it in square brackets;
Code:
Me.[B][COLOR="Red"][[/COLOR][/B]Name[B][COLOR="Red"]][/COLOR][/B].Locked = True
 
Yay that worked! Thank you so much! :)

Any chance you could help me with my other problem? I posted a thread on it but I got no replies :(
 

Users who are viewing this thread

Back
Top Bottom