[AccessD] Lock/Disable controls in the Detail section of a form

Mark A Matte markamatte at hotmail.com
Thu Jul 29 09:34:16 CDT 2004


Nancy,

This is a sample of how you might accomplish this...you would call this 
function after the form opens depending on a value you set when calling the 
form.  You will have to add an if statement to exclude any command 
buttons...or items in the detail section that do not have the 'locked' 
property.
Thanks,

Mark A. Matte

Sub TextBoxProperties(frm As Form)
    On Error GoTo Skip
    Dim ctl As Control
    ' Enumerate Controls collection.
    For Each ctl In frm.Controls
            Dim test
            Dim name
            name = ctl.ControlName
            test = ctl.Section
            With ctl
                'Default = .DefaultValue
                If test = 0 Then
                ctl.Locked = True
                Else
                End If

Skip:
            End With
        'End If
    Next ctl
End Sub


>From: "Susan Harkins" <ssharkins at bellsouth.net>
>Reply-To: Access Developers discussion and problem 
>solving<accessd at databaseadvisors.com>
>To: "'Access Developers discussion and problem 
>solving'"<accessd at databaseadvisors.com>
>Subject: RE: [AccessD] Lock/Disable controls in the Detail section of a 
>form
>Date: Thu, 29 Jul 2004 10:02:16 -0400
>
>Nancy, there may be a Detail event that you could use, but I don't think 
>so.
>Have you considered renaming the controls? For instance, all the controls 
>in
>the detail section might include a prefix or suffix "dtl" or something
>similar. That way you could loop through the entire form's collection and
>stop only when it finds the appropriate prefix or suffix.
>
>Susan H.
>
>Is there any way to lock only the controls in the Detail section of a form.
>
>
>--
>_______________________________________________
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com

_________________________________________________________________
Discover the best of the best at MSN Luxury Living. http://lexus.msn.com/




More information about the AccessD mailing list