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

Determining if a control is locked

Status
Not open for further replies.

theUN4GVEN

Programmer
Apr 12, 2004
10
US
I have code on a few of my forms that adds the date to the text in the textBox control that has the focus when a specific key combination is pressed. The problem I have is when a textBox that is locked has the focus. When the key combination is pressed a run-time error occurs saying the property is read-only and can not be set.

The code determines which control has the focus and determines whether or not it is a textBox but I don't know how to determine if the textBox is locked. Any help would greatly appreciated.

Thanks,
Tom
 
No point in testing it, just set it to false:
me.controlname.locked = false
 
If Me.txtBox.Locked = True Then
MsgBox "Locked!"
End If
 
Don't know what code you're using, but assuming you're using ctl as control:

[tt]if ctl.locked then[/tt]

- but - I thought the enabled and locked properties of controls where only a user interface thing, and that you could assign values to the control programatically (well, I can on my setup)

Roy-Vidar
 
Thanks, I didn't realize I could check the status of control properties so easily. Worked like a charm.

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top