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

How to lock a field in a Tab Control

Status
Not open for further replies.

nycbigapple

Technical User
Apr 4, 2006
33
US
Hi, I am trying to lock a text field in a tab control with a check box. I am able to lock the field but it locks all the records. I unlock the field it unlocks all the records.
any ideas? thanks
Private Sub Form_Current()
If Me.NewRecord Or Not Me!LockE Then
Me.txtSecE.Locked = False
Me.txtSecE.BackColor = 1677215
Else
Me.txtSecE.Locked = True
Me.txtSecE.BackColor = 11075496
.......
 
Typical behaviour of an unbound checkbox.

Pampers [afro]
There is only one way to change a diaper - fast
 
Any other way around this so it doesn't lock every single record?
 
I am able to put a check box outside the tab control and it works fine but not in the tab control. For design purposes I would like it to be in the tab control
 
a tab control is just an extension of the main form. What you could do is bound the checkbox (chkLock) to a field in your table so you could lock every single record.


Pampers [afro]
There is only one way to change a diaper - fast
 
That is what I have I have a field called lockH in my table that is bound to a checkbox. I created a checkbox outside of the tab field and drag it in and it seems to be working. However,

I have a group of option boxes in the tab, when I select an option it checks it then when I move to the next record and back the option that I have had selected is no longer selcted.

Why is it doing this? I am trying to lock the fields if the check box is checked. I am using the code above to determine if it is checked or not. And tblNCR is joined to the option table
 
Try and cut and paste the checkbox onto the tab instead of dragging, and make sure that if you paste it, the specific tab is selected.


Pampers [afro]
There is only one way to change a diaper - fast
 
I think my problem is now how can I lock an option group. The check box is working. When I have a 4 option group, If I select one item and go back into the record it is not saved in the field. When I remove this code below the field is still updated but the field is not locked.

How can I lock my option box so that it can not be alter and when I go back in it is the value that I selected
Thanks

Private Sub Form_Current()
If Me.NewRecord Or Not Me!LockH Then
Me.grpImpact.Locked = False
Else
Me.grpImpact.Locked = True
Me.grpImpact.Value = 11075496 Me.grpImpact.Value = 16777215
 
I think I sovled my own problem, I had a value in there for grpImpact, duh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top