[AccessD] Read Only Form

Jim Dettman jimdettman at verizon.net
Sun May 9 13:02:24 CDT 2010


Rocky,

  When I had setups like that, I would lock/unlock all the controls on the
fly.  However I'd do that only on controls in the detail section of the
form.   Any type of "control panel" type stuff (find, navigation, etc) I
would put in the form header. Below is the procedure I used to do that with.

  I've also seen developers use the Tag property of a control to do this.
Ie. if "NOLOCK" or some such is found in the tag property, then don't
lock/unlock the control.

Jim.

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 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
Sent: Saturday, May 08, 2010 7:32 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Read Only Form

Dear List:

I have several apps where the user enters their name and a password.  The
user has either read only, read/write, or admin access.  When a form is
opened by a user with read only access I can set allow additions, deletions
and edits to false and that works good.  

Except when the user clicks 'Find' and the combo box drops down with the
list of customers or whatever.  Then I have to set AllowEdits to True
temporarily and then, in the Lost Focus event for the combo box  set
AllowEdits to False.  Which works.  But seems clumsy and kludgey.  Is there
a more elegant way to finesse this need to have one (or more) control(s)
editable on a form that doesn't allow edits?

 

MTIA

 

Rocky Smolin

Beach Access Software

858-259-4334

www.e-z-mrp.com <http://www.e-z-mrp.com/> 

www.bchacc.com <http://www.bchacc.com/> 

 

 





More information about the AccessD mailing list