Kath Pelletti
kp at sdsonline.net
Tue Feb 12 21:56:21 CST 2008
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