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

Subform field locked due to connection to main form code

Status
Not open for further replies.

Vittles

Programmer
Dec 7, 2000
95
US
I added a locked field to my main table and added the following code to the main forms on current and also the 'locked' checkbox's after update events:
Dim c As Control
On Error Resume Next
If Me.LockedCB = True Then
For Each c In Me.Controls
If c.Name = "LockedCB" Or c.Name = "CTU PI Name Search" Then
Else
c.Locked = True
End If
Next
Else
For Each c In Me.Controls
If c.Name = "LockedCB" Then
Else
c.Locked = False
End If
Next
End If
End Sub

It locks all the controls if the 'locked' checkbox is checked, including the subforms which is what I needed except I want staff to be able to access one unbound combo box (KP Name Search)in order to 'find' various subform records.

I have played with adding an 'Or c.Name="KP Name Search" or (c.Parent.Name="KP COI Subform" And c.Name="KP Name Search") without any luck of having this field lock setting set to false. I also tried to set it's own event properties and the related subform events to set it to be unlocked.... Is there some other way to do this?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top