A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Disable and Lock All Feilds wiht a check box



 
 
Thread Tools Display Modes
  #1  
Old April 26th, 2010, 09:07 PM posted to microsoft.public.access.forms
Biss
external usenet poster
 
Posts: 24
Default Disable and Lock All Feilds wiht a check box

Hi I am using MS 2007 and have a form that I would like to lock = yes and
enable = No on all fields..

I would like to do this by checking a check box.. I would also like to have
the lock = no and enable = yes when I uncheck the check box..

Any ideas would be appreciated..

Many thanks in advance.

Bob



  #2  
Old April 26th, 2010, 10:00 PM posted to microsoft.public.access.forms
Maurice
external usenet poster
 
Posts: 1,585
Default Disable and Lock All Feilds wiht a check box

Why would you want to disable all the fields if you lock them? Seems a bit
double but in this case you could go for the option to allow edits or not.
So in the click event of the checkbox you could set something like:

if me.chkEnable then
me.allowedits=true
me.allowadditions=true
else
me.allowedits=false
me.allowadditions=false
end if

etc.

or even tighter you could set the property of the form to read only..
hth
--
Maurice Ausum


"Biss" wrote:

Hi I am using MS 2007 and have a form that I would like to lock = yes and
enable = No on all fields..

I would like to do this by checking a check box.. I would also like to have
the lock = no and enable = yes when I uncheck the check box..

Any ideas would be appreciated..

Many thanks in advance.

Bob



  #3  
Old April 27th, 2010, 04:03 AM posted to microsoft.public.access.forms
Biss
external usenet poster
 
Posts: 24
Default Disable and Lock All Feilds wiht a check box

Thanks Maurice,

To tell you the truth I never new allow edits was a option, but it only
makes sense that it would be there

I would put this in the clic even or afterupdate event.

if me.chkenable then
me.allowedits=true
else
me.allowedits=false
end if

or do I have that backwards if I want to have the form read only when the
check box is checked?

Thanks again Maurice..

Bob

Que tenga buena noche.



"Maurice" wrote in message
...
Why would you want to disable all the fields if you lock them? Seems a bit
double but in this case you could go for the option to allow edits or not.
So in the click event of the checkbox you could set something like:

if me.chkEnable then
me.allowedits=true
me.allowadditions=true
else
me.allowedits=false
me.allowadditions=false
end if

etc.

or even tighter you could set the property of the form to read only..
hth
--
Maurice Ausum


"Biss" wrote:

Hi I am using MS 2007 and have a form that I would like to lock = yes and
enable = No on all fields..

I would like to do this by checking a check box.. I would also like to
have
the lock = no and enable = yes when I uncheck the check box..

Any ideas would be appreciated..

Many thanks in advance.

Bob



  #4  
Old April 27th, 2010, 02:26 PM posted to microsoft.public.access.forms
Maurice
external usenet poster
 
Posts: 1,585
Default Disable and Lock All Feilds wiht a check box

Biss,

Try this in the click event of the checkbox:

Private Sub Checkbox_Click()
If Me.Checkbox Then
Dim ctl As Control

For Each ctl In Me
If TypeOf ctl Is TextBox Or TypeOf ctl Is ComboBox Then
ctl.Enabled = False
End If
Next
Else
For Each ctl In Me
If TypeOf ctl Is TextBox Or TypeOf ctl Is ComboBox Then
ctl.Enabled = True
End If
Next
End If
End Sub

if you try to use the checkbox in combination with allowedits you'll see
that you can toggle the checkbox once and after that you cannot remove the
check anymore because edits aren't allowed.

the first option will disable the controls where the Else will enable the
controls again.

hth

--
Maurice Ausum


"Biss" wrote:

Thanks Maurice,

To tell you the truth I never new allow edits was a option, but it only
makes sense that it would be there

I would put this in the clic even or afterupdate event.

if me.chkenable then
me.allowedits=true
else
me.allowedits=false
end if

or do I have that backwards if I want to have the form read only when the
check box is checked?

Thanks again Maurice..

Bob

Que tenga buena noche.



"Maurice" wrote in message
...
Why would you want to disable all the fields if you lock them? Seems a bit
double but in this case you could go for the option to allow edits or not.
So in the click event of the checkbox you could set something like:

if me.chkEnable then
me.allowedits=true
me.allowadditions=true
else
me.allowedits=false
me.allowadditions=false
end if

etc.

or even tighter you could set the property of the form to read only..
hth
--
Maurice Ausum


"Biss" wrote:

Hi I am using MS 2007 and have a form that I would like to lock = yes and
enable = No on all fields..

I would like to do this by checking a check box.. I would also like to
have
the lock = no and enable = yes when I uncheck the check box..

Any ideas would be appreciated..

Many thanks in advance.

Bob



  #5  
Old May 7th, 2010, 04:54 AM posted to microsoft.public.access.forms
PieterLinden via AccessMonster.com
external usenet poster
 
Posts: 307
Default Disable and Lock All Feilds wiht a check box

Biss wrote:
Hi I am using MS 2007 and have a form that I would like to lock = yes and
enable = No on all fields..

I would like to do this by checking a check box.. I would also like to have
the lock = no and enable = yes when I uncheck the check box..

Any ideas would be appreciated..

Many thanks in advance.

Bob


I assume it works the same as all previous versions of Access

Dim ctl as Control
For Each ctl In Me.Controls
if ctl.Name"chkBoxToLeaveEnabled" Then
ctl.Enabled = (Not me.chkLockForm)
ctl.Locked = Me.chkLockForm
end if
Next ctl

then you could throw in an IF statement to skip over the checkbox....

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201005/1

 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:12 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.