Disable edits in a tabbed form

mafhobb

Registered User.
Local time
Today, 12:23
Joined
Feb 28, 2006
Messages
1,249
I have a form called Contacts that has two tabs. One is called General adn the other Calls.

In the General tab I have a bound field called CustomerIDdet which can be numeric or alphanumeric. I need to disable edits in the General tab but not in the Calls tab if CustomerIDdet is numeric (and it follows certain additional rules)

I have placed this code in the Onload even for the form:
Code:
    If Len(CustomerIDdet) = 9 Then
        If IsNumeric(CustomerIDdet) Then
            If Right(CustomerIDdet, 4) = 9090 Then
                If Left(CustomerIDdet, 1) = 0 Then
                'disable editing in the General tab
                End If
            End If
        End If
    End If

I know how to disable edits control by control, but can I disable edits in all controls in that tab at once?

Thanks

mafhobb
 
change the name of page2. this should work page2 is the name of the tab.

Code:
Dim ctrl As Control
For Each ctrl In Page2.Controls
    If ctrl.ControlType = acTextBox Then
    ctrl.Enabled = False
    End If
    Next ctrl
 
That worked great.

Thanks!

Mafhobb
 

Users who are viewing this thread

Back
Top Bottom