Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-access > #10918

Re: Unlock all the fields in a form

From "Phil" <phil@stantonfamily.co.uk>
Newsgroups comp.databases.ms-access
Subject Re: Unlock all the fields in a form
Date 2015-07-07 17:53 +0100
Organization Aioe.org NNTP Server
Message-ID <mnh062$ltg$1@speranza.aioe.org> (permalink)
References <4d411ad4-21c1-4450-8372-0eae454dbb5e@googlegroups.com>

Show all headers | View raw


On 07/07/2015 17:13:20, musicloverlch wrote:
> Hello friends,
> 
> Here's the situation. I have a form with lots of text fields and buttons.
> They all have their own individual lock and enable settings depending on
> the client specifications.
> 
> For a couple of users I need to unlock every text field and button on the
> form so they can fix things when one of their employees screw something
> up.
> 
> I found some great code that would cycle through all the fields in a form
> and lock or unlock them. It was something like:
> 
> Dim CTL as Control
> 
> For Each CTL In Me.Controls
> CTL.Locked = False
> Next CTL
> 
> But that doesn't work and, of course, I can't find it again.
> 
> How can I unlock all the fields in a form without listing them
> individually?
> 
> Thanks in advance,
> Laura
> 

I trhink you are on the right track, but ....
Certain types of controls (e.g. Labels, Images, lines etc.) can't be locked

Try

For Each CTL In Me.Controls
   If TypeOf Ctl Is TextBox _
   Or TypeOf Ctl Is ListBox _
   Or TypeOf Ctl Is ComboBox _
   Or TypeOf Ctl Is SubForm _
   Or TypeOf Ctl Is OptionGroup _
   Or TypeOf Ctl Is CheckBox then
         CTL.Locked = False
    end if
Next CTL

There may be others that you want to lock.
Phil

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

Back to comp.databases.ms-access | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Unlock all the fields in a form musicloverlch <lhowey@gmail.com> - 2015-07-07 09:13 -0700
  Re: Unlock all the fields in a form CDMAPoster@fortunejames.com - 2015-07-07 09:47 -0700
  Re: Unlock all the fields in a form "Phil" <phil@stantonfamily.co.uk> - 2015-07-07 17:53 +0100
  Re: Unlock all the fields in a form Patrick Finucane <patrickfinucanetx@gmail.com> - 2015-07-07 10:16 -0700
  Re: Unlock all the fields in a form "Joan Wild" <joanwild@xplornet.com> - 2015-07-10 22:17 +0000

csiph-web