[AccessD] Locking form controls 2003

jwcolby jwcolby at colbyconsulting.com
Wed Feb 13 08:45:14 CST 2008


BTW, since a control that is not visible cannot have the focus, the same
applies to setting a control to invisible. 


John W. Colby
Colby Consulting
www.ColbyConsulting.com 
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: Wednesday, February 13, 2008 9:35 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Locking form controls 2003

That is correct, sorry for the mis-statement.  In order for a control to get
the focus it has to be enabled.  It CAN be locked and get the focus.  In
order to DISABLE a control it must NOT have the focus.

Sorry about that. 


John W. Colby
Colby Consulting
www.ColbyConsulting.com
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Wednesday, February 13, 2008 8:17 AM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Locking form controls 2003

Hi John

Isn't it Enabled you have in mind? 
For example, a button doesn't have a Locked property. But a textbox has and
it can be set to True while the textbox has focus.

/gustav

>>> jwcolby at colbyconsulting.com 13-02-2008 14:00 >>>
Additionally ALL controls have to NOT have the focus before they can be
locked.  By that I mean that you cannot lock a control while it has the
focus.  You have to set the focus to some other control, then lock the
control. 


John W. Colby
Colby Consulting
www.ColbyConsulting.com
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence
Sent: Wednesday, February 13, 2008 6:56 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Locking form controls 2003

Hi Kath:

Just off the top... some objects have to have focus before they can be set.

Jim

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kath Pelletti
Sent: Tuesday, February 12, 2008 7:56 PM
To: Access D Normal List
Subject: [AccessD] Locking form controls 2003

Help please gurus.......trying to develop a routine which will lock (or
disable) controls on a form. (Access 2003)

I am getting error 438 'Object doesn't support this property or method' on
the line 'Select Case ctl.type'. 

Any idea why? I am using code I have used in 2000. Can I no longer say
ctl.type? 

See code below:

----------------------------------------------------------------------------
----


Code :

Public Function LockControls(strformname As String) Dim frmIn As Form Dim
strerrormsg As String Dim ctl As Control 'On Error GoTo Err_Handler
    
Set frmIn = Forms(strformname)
    For Each ctl In frmIn.Controls
             Select Case ctl.Type                                    'error
occurs on this line............
                 Case acTextBox: ctl.Locked = True
             End Select
    Next

Normal_exit:
    DoCmd.SetWarnings True
    Exit Function

Err_Handler:
    MsgBox "Error: [" & Err.Number & "]  " & IIf(Len(strerrormsg) > 0,
strerrormsg, Err.Description), vbCritical, "Error Message"
    Resume Normal_exit
End Function

______________________________________
Kath Pelletti
Software Design and Solutions Pty Ltd
Ph: 9505-6714
Fax: 9505-6430
kp at sdsonline.net 


--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
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