[AccessD] Locking form controls 2003

Jim Lawrence accessd at shaw.ca
Wed Feb 13 05:56:05 CST 2008


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




More information about the AccessD mailing list