The Textbox Locked preoperty (1 Viewer)

sja13

Professional Idiot
Local time
Today, 16:07
Joined
May 3, 2017
Messages
63
I have a table of Locations (tblLocation), a Query which returns all Locations (qryAllLocation) from tblLocation, and a Form (frmLocation) whose datasource is qryAllLocation.

On the Form frmlocation I have text boxes whose Control Source properties are set to fields in the Table tblLocation.

On the Form I also have navigation command buttons for first, previous, next and last.

These command buttons execute the relevant DoCmd.GotoRecord functions (acFirst, acPrevious, acNext, and acLast).

What seems to be unexpectedly happening is that if I overtype anything in a text box then click a navigation button, whatever I typed is saved in the record, which I didn’t expect to happen.

Is this perhaps related to the “Locked” property?

I’ve read that setting Locked to True means the data can be changed, which seems counter-intuitive (e.g. you can’t change the state of a locked door without unlocking it). Unless I’m being dim (quite likely) I’m still not clear on what the Locked property actually controls.

If I’m on the right track, if I set all the textboxes to Locked=False, the User can’t update the underlying table by overwriting the contents of the textbox, and if I want the User to be able to update the data, I need to set the Locked property to True.

As I’m new to Access (Office 2010), am I barking up a blue herring?
 

isladogs

MVP / VIP
Local time
Today, 16:07
Joined
Jan 14, 2017
Messages
18,258
You are indeed barking up a blue herring....

Imagine the textbox as being like your front door.
If its locked, you can't open it (edit it)
If its unlocked you can open /edit it.

So if you want users to be able to enter or edit data, you need locked =false.
If you need it to be read only, then set locked=true

Changes to bound controls are saved as soon as you leave the control
 

sja13

Professional Idiot
Local time
Today, 16:07
Joined
May 3, 2017
Messages
63
Ah, but if the door was hinged at the top, and guarded by an enormous purple ferret armed with a bent skeleton key, on which were written the words "ridders is helpful", would I still be able to play the piano?
 

isladogs

MVP / VIP
Local time
Today, 16:07
Joined
Jan 14, 2017
Messages
18,258
Yes if you came in through the cat flap... and of course can play it anyway
 

Users who are viewing this thread

Top Bottom