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!

Locking Controls

Status
Not open for further replies.

cranebill

IS-IT--Management
Jan 4, 2002
1,113
0
0
US
I have a form based on a recordset and using vba would like to lock certain controls to keep users from editing data. I used the following:

Forms!Formname.Controlname.Locked = True

Upon doing this when the form opens it gives me errors, however wen i remove that statement it runs fine. Is there a way to lock controls on forms to keep people from editing them?

Bill
 
If this is a permanent thing, open the form in Design view and set the property Enabled = False *AND/OR* Locked = True.


Your statement should have worked. I don't know why it failed. If you want, you can use the immediate window (CTRL-G) and try typing in "?Forms!frmName.Name" as an example of how to troubleshoot parts of your statement. --
Find common answers using Google Groups:

 
Try "right-clicking" on the control on the design mode of the form, then selecting "properties", then going to the "data" tab, then setting "locked" equal to "true"? This will set the control default to locked. Then based on an event you can reset it so that locked equals true. (some controls like buttons can't be locked but you can set "enabled" equal to "no" which will do the same thing)
 
Thanx for the ideas... however it works really well when you point it to the control and not a typo... dang typing skills stink today... can tell its Monday lol. Thank you for the quick replies though.

Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top