[AccessD] Locking form controls 2003

Jim Lawrence accessd at shaw.ca
Wed Feb 13 12:29:25 CST 2008


Hi John:

I meant the opposite... it was very late for me and the brain and fingers
were not fully engaged...

Jim 

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

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

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