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

Jim Dettman jimdettman at earthlink.net
Thu Jul 29 09:44:47 CDT 2004


Nancy,

<<Is there any way to lock only the controls in the
Detail section of a form.>>

  Sure.

Function StdLockForm(frm As Form, intState As Integer)

  'Lock/unlock all the fields in the detail section of the form that are
enabled.

  Dim intL As Integer              'Generic loop counter
  Dim intCount As Integer          'Number of controls on the form

  intCount = frm.Count             'Find out how many controls are on the
form

  On Error Resume Next
  For intL = 0 To intCount - 1      'Step thru all controls on the form
    If (frm(intL).Section = False) Then 'Don't do any control execpt those
in the detail section
        If (frm(intL).Enabled = True) Then frm(intL).Locked = intState
'Set 'Locked' property to proper state
    End If
  Next intL
  On Error GoTo 0

End Function

Jim Dettman
(315) 699-3443
jimdettman at earthlink.net

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Nancy Lytle
Sent: Thursday, July 29, 2004 9:51 AM
To: AccessD at databaseadvisors.com
Subject: [AccessD] Lock/Disable controls in the Detail section of a form


Is there any way to lock only the controls in the
Detail section of a form.

The page header section has my filtering and
navigation, and other standard buttons.  All the data
entry is done in the detail section.
I would like to be able to open the form in two ways,
one where the users can edit or add to the form data,
another where they can search using the controls in
the form header but they can't edit or add to the data
in the detail section of the form, which also contains
a subform.

I have tried the following called in the Current event
of the form (I also tried it in several other events
and it didn't do any better):

blnDisable is set in the OnClick event buttons used to
open the form (from another form) for Data Entry or
Open for Search only.

Public blnDisable As Boolean ' in declaration section
of a module

Public Function fcnCheckDisable()
If blnDisable = True Then
Me.Section(acDetail).Locked = True
 Else
Me.Section(acDetail).Locked = False
 End If

End Function

Any ideas appreciated,
Thanks,
Nancy Lytle
--
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list