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

Tab form - How to disbale controls on LoseFocus

Status
Not open for further replies.

darinmc

Technical User
Feb 27, 2005
171
GB
Hi
I have a tab control form and the below code, when clicking a cmd button, enables controls on a form when i want to change records.

Is there a way to disable those controls when I click on another tab? Using the losefocus command. However I can only see Onclick or mousemove etc

Code:
Private Sub cmdChgAccount_Click()
Dim ctl As Control
For Each ctl In Me
If ctl.Tag = "Bank" Then
ctl.Enabled = True
'ctl.Locked = Not (ctl = "" Or IsNull(ctl))
End If
Next ctl
End Sub

Thx for ur help
Darin
 
Use the on change event of a tab control. The value of a tab control is equal to the index of the tab.

To see this work type something like:

Private Sub TabCtl0_Change()
MsgBox Me.TabCtl0.Value
End Sub
 
Thanks, that help and by using below code, got the basics working.

Code:
Private Sub TabCtl0_Change()
Dim ctl As Control
 'MsgBox Me.TabCtl0.Value
' Page Index = 1
If Me.TabCtl0.Value = 1 Then
For Each ctl In Me
If ctl.Tag = "Bank" Then
ctl.Locked = True
End If
Next ctl
End If
End Sub

thx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top