PC Review


Reply
Thread Tools Rate Thread

Lock all Controls

 
 
Grace
Guest
Posts: n/a
 
      8th Apr 2008
Hi,

I need to Lock all controls of a FORM1 and a SUBFORM (within the form1) through a command
button

How can I do?

Thanks in advance.

Grace.-
 
Reply With Quote
 
 
 
 
pddxxx@gmail.com
Guest
Posts: n/a
 
      8th Apr 2008
Something like this should work from a command button event procedure:

dim ctl as control
on error resume next
for each ctl in me.controls
ctl.locked = true
next ctl
set ctl = nothing
on error goto 0

Hope this helps,

Peter De Baets
http://www.peterssoftware.com



 
Reply With Quote
 
UTOPIAN
Guest
Posts: n/a
 
      8th Apr 2008
Hello! thanks for reply

Sorry!I spoke badly!

I need the command button ENABLE controls when it is pressed... and that
LOCK when it returns to pressure AND the switch to next RECORD.

Thanks!

--------------------------------------------------------------------------------


<(E-Mail Removed)> escribió en el mensaje de
noticias:386a6cb3-8816-4de7-b01a-(E-Mail Removed)...
> Something like this should work from a command button event procedure:
>
> dim ctl as control
> on error resume next
> for each ctl in me.controls
> ctl.locked = true
> next ctl
> set ctl = nothing
> on error goto 0
>
> Hope this helps,
>
> Peter De Baets
> http://www.peterssoftware.com
>
>
>

 
Reply With Quote
 
Allen Browne
Guest
Posts: n/a
 
      8th Apr 2008
See:
Locking bound controls on a form and subforms
at:
http://allenbrowne.com/ser-56.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Grace" <(E-Mail Removed)> wrote in message
news:4D572375-5A3C-49F3-A454-(E-Mail Removed)...
Hi,

I need to Lock all controls of a FORM1 and a SUBFORM (within the form1)
through a command
button

How can I do?

Thanks in advance.

Grace.-

 
Reply With Quote
 
Priscilla
Guest
Posts: n/a
 
      10th Apr 2008
I implemented the code you had listed on your site. (Works like a
charm-thanks. However in my case I would like to only lock down certain
records that have an attribute. For example, I have 700 records that contain
various fields. One of these fields is of type yes/no. I would only like to
lock the form for records that have the "yes" selected, versus locking all
forms. Can the method you displayed here be used to accomplish this?
--
Priscilla


"Allen Browne" wrote:

> See:
> Locking bound controls on a form and subforms
> at:
> http://allenbrowne.com/ser-56.html
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Grace" <(E-Mail Removed)> wrote in message
> news:4D572375-5A3C-49F3-A454-(E-Mail Removed)...
> Hi,
>
> I need to Lock all controls of a FORM1 and a SUBFORM (within the form1)
> through a command
> button
>
> How can I do?
>
> Thanks in advance.
>
> Grace.-
>
>

 
Reply With Quote
 
Allen Browne
Guest
Posts: n/a
 
      11th Apr 2008
Use the Current event of the form to call:
Call LockBoundControls(Me, Nz(Me.[YourYesNoField],False))

You probably want to do this in Form_AfterUpdate as well.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Priscilla" <(E-Mail Removed)> wrote in message
news:795E9160-103E-4E5C-83D7-(E-Mail Removed)...
>I implemented the code you had listed on your site. (Works like a
> charm-thanks. However in my case I would like to only lock down certain
> records that have an attribute. For example, I have 700 records that
> contain
> various fields. One of these fields is of type yes/no. I would only like
> to
> lock the form for records that have the "yes" selected, versus locking all
> forms. Can the method you displayed here be used to accomplish this?
> --
> Priscilla


 
Reply With Quote
 
Priscilla
Guest
Posts: n/a
 
      11th Apr 2008
Thank you so much. That is exactly what I was looking for. Much appreciated
--
Priscilla


"Allen Browne" wrote:

> Use the Current event of the form to call:
> Call LockBoundControls(Me, Nz(Me.[YourYesNoField],False))
>
> You probably want to do this in Form_AfterUpdate as well.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Priscilla" <(E-Mail Removed)> wrote in message
> news:795E9160-103E-4E5C-83D7-(E-Mail Removed)...
> >I implemented the code you had listed on your site. (Works like a
> > charm-thanks. However in my case I would like to only lock down certain
> > records that have an attribute. For example, I have 700 records that
> > contain
> > various fields. One of these fields is of type yes/no. I would only like
> > to
> > lock the form for records that have the "yes" selected, versus locking all
> > forms. Can the method you displayed here be used to accomplish this?
> > --
> > Priscilla

>
>

 
Reply With Quote
 
Tim
Guest
Posts: n/a
 
      23rd Apr 2008
I have successfully implemented the referenced code with one exception;
When I set my form "On Load" property to =LockBoundControls([Form],True) I
get the following error - "Compile error" "Expected: line number or label or
statement or end of statement" The equal sign is highlighted. Does something
need to go before this? I'm assuming "Form" in the code needs to be replaced
by the name of my form?

Thanks!

Tim
 
Reply With Quote
 
sldfkj
Guest
Posts: n/a
 
      7th May 2008

"Grace" <(E-Mail Removed)> 写入邮件 news:4D572375-5A3C-49F3-A454-(E-Mail Removed)...
Hi,

I need to Lock all controls of a FORM1 and a SUBFORM (within the form1) through a command
button

How can I do?

Thanks in advance.

Grace.-
 
Reply With Quote
 
Guest
Posts: n/a
 
      20th May 2008
hi :
can you help me ?

"Grace" <(E-Mail Removed)> ??????:4D572375-5A3C-49F3-A454-(E-Mail Removed)...
Hi,

I need to Lock all controls of a FORM1 and a SUBFORM (within the form1) through a command
button

How can I do?

Thanks in advance.

Grace.-
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lock all Controls Grace Microsoft Access Forms 9 20th May 2008 11:37 AM
Lock all Controls Grace Microsoft Access Form Coding 11 20th May 2008 11:37 AM
Lock controls in VBA poppy Microsoft Excel Programming 3 23rd Nov 2004 02:51 PM
lock all controls Ryan Moore Microsoft C# .NET 1 17th Nov 2003 07:14 PM
lock controls all in one go Newbie Microsoft Access Form Coding 1 7th Nov 2003 05:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:32 PM.