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

Lock Each Control In form IF.....

Status
Not open for further replies.

DrDan1

Technical User
Oct 2, 2002
127
GB
Hey there. I have the following code:

If [Accession Number] = 0 Then
Me!Comments.Locked = True
Me!Description.Locked = True
End If

This works fine. It locks the chosen controls if the value of Accession Number is 0. But there must be way of writing code that'll do the same for every control in the page, i.e. lock all controls if [Accession Number] = 0.... without writing Me![Control].Locked = True for each individual control. ----------------------------------------
Knowing is not enough, we must apply. Willing is not enough, we must do.
--So said the ever wise Bruce Lee
Memorize and live by it!
 
Hi

Private Sub Form_Load()
Dim ctl As Control
For Each ctl In Me.Controls
Select Case ctl.ControlType
Case acTextBox
ctl.Locked = True
Case Else
' do nothing
End Select
Next ctl
End Sub Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top