Susan Harkins
ssharkins at bellsouth.net
Wed Jun 8 07:14:13 CDT 2005
It worked for me -- almost. I had to qualify all the form references by adding Forms! -- and it worked. Also, I think you need to add -1 to the count definition: For intFields = 0 To frmClient.Controls.Count - 1 Susan H. To all, I have a lot of text boxes, combo boxes and check boxes on a form and need them locked for certain users I tried the following code to loop through them and when txt, pv or chk is found to lock or disable the control but it doesn't work.... Dim intFields As Integer For intFields = 0 To frmClient.Controls.Count If (Left(frmClient.Controls(intFields).Name, 3) = "chk" Or Left(frmClient.Controls(intFields).Name, 3) = "txt") Then frmClient(frmClient.Controls(intFields).Name).Locked = True End If If (Left(frmClient.Controls(intFields).Name, 2) = "PV") Then frmClient(frmClient.Controls(intFields).Name).Enabled = False End If Next intFields can anyone tell me what I am doing wrong cause I can't seem to see the wood for the tree's at the moment... Thanks in advance for all your help... Paul Hartland -- Whatever you Wanadoo: http://www.wanadoo.co.uk/time/ This email has been checked for most known viruses - find out more at: http://www.wanadoo.co.uk/help/id/7098.htm -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com