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  

Set All Bollean Datatype to False on reset



 
 
Thread Tools Display Modes
  #1  
Old October 9th, 2009, 04:42 AM posted to microsoft.public.access.forms
edisonl via AccessMonster.com
external usenet poster
 
Posts: 68
Default Set All Bollean Datatype to False on reset

Hi,

any idea how can I explicitly set all Boolean Datatype within a form to FALSE
with a On_Click Button ?

Regards, Edison

--
Message posted via http://www.accessmonster.com

  #2  
Old October 9th, 2009, 05:09 AM posted to microsoft.public.access.forms
Arvin Meyer [MVP][_2_]
external usenet poster
 
Posts: 2,310
Default Set All Bollean Datatype to False on reset


"edisonl via AccessMonster.com" u47544@uwe wrote in message
news:9d50cc28b3d2e@uwe...
Hi,

any idea how can I explicitly set all Boolean Datatype within a form to
FALSE
with a On_Click Button ?


Put this in a standard module named basUtilities or something:

Public Sub CheckIt(frm As Form)

Dim ctl As Control

For Each ctl In frm.Controls
If ctl.Controltype = acCheckBox
ctl.Value = False
End If

Next ctl

Set ctl = Nothing
Set frm = Nothing

End Sub

Then call it from a command button:

Private Sub cmdWhatever_Click()
Call CheckIt(Me)
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

Disclaimer: Any code or opinions are offered here as is. Some of that
code has been well tested for number of years. Some of it is untested
"aircode" typed directly into the post. Some may be code from other
authors. Some of the products recommended have been purchased and
used by the author. Others have been furnished by their manufacturers.
Still others have not been personally tested, but have been
recommended by others whom this author respects.


  #3  
Old October 9th, 2009, 05:09 AM posted to microsoft.public.access.forms
Tom van Stiphout[_2_]
external usenet poster
 
Posts: 1,653
Default Set All Bollean Datatype to False on reset

On Fri, 09 Oct 2009 03:42:41 GMT, "edisonl via AccessMonster.com"
u47544@uwe wrote:

Easier to do all checkboxes:
dim ctl as control
for each ctl in me.controls
if typeof(ctl) is checkbox then
ctl.value = false
endif
next

-Tom.
Microsoft Access MVP


Hi,

any idea how can I explicitly set all Boolean Datatype within a form to FALSE
with a On_Click Button ?

Regards, Edison

  #4  
Old October 9th, 2009, 09:55 AM posted to microsoft.public.access.forms
edisonl via AccessMonster.com
external usenet poster
 
Posts: 68
Default Set All Bollean Datatype to False on reset

Hi Tom,

Sorry I may have not explain myself clearly.

What I wanted to achieve was to set Boolean that is declared as public
variable within a form in VB editor as False on exit or Form_Load

Regards, Edison

Tom van Stiphout wrote:
Easier to do all checkboxes:
dim ctl as control
for each ctl in me.controls
if typeof(ctl) is checkbox then
ctl.value = false
endif
next

-Tom.
Microsoft Access MVP

Hi,

any idea how can I explicitly set all Boolean Datatype within a form to FALSE
with a On_Click Button ?

Regards, Edison


--
Message posted via http://www.accessmonster.com

  #5  
Old October 9th, 2009, 02:41 PM posted to microsoft.public.access.forms
Tom van Stiphout[_2_]
external usenet poster
 
Posts: 1,653
Default Set All Bollean Datatype to False on reset

On Fri, 09 Oct 2009 08:55:26 GMT, "edisonl via AccessMonster.com"
u47544@uwe wrote:

Ah, got you. There is no way to set multiple variables to True or
False with one statement. So you'll have to write a statement for
each. I would put it all in a subroutine:
private sub SetAllBooleans(byval blnValue as boolean)
myFirstBool = blnValue
mySecondBool = blnValue
'etc
end sub

Then call this with:
SetAllBooleans True
or
SetAllBooleans False

This way at least you don't have to write each statement twice, once
for true and once for false.

-Tom.
Microsoft Access MVP



Hi Tom,

Sorry I may have not explain myself clearly.

What I wanted to achieve was to set Boolean that is declared as public
variable within a form in VB editor as False on exit or Form_Load

Regards, Edison

Tom van Stiphout wrote:
Easier to do all checkboxes:
dim ctl as control
for each ctl in me.controls
if typeof(ctl) is checkbox then
ctl.value = false
endif
next

-Tom.
Microsoft Access MVP

Hi,

any idea how can I explicitly set all Boolean Datatype within a form to FALSE
with a On_Click Button ?

Regards, Edison

  #6  
Old October 9th, 2009, 05:53 PM posted to microsoft.public.access.forms
Arvin Meyer [MVP][_2_]
external usenet poster
 
Posts: 2,310
Default Set All Bollean Datatype to False on reset

If it's a single Public Boolean variable, you can more reliably set it in
form Current, unless you want it to persist for the session. In either case,
you simply set it to false, no matter where you set it:

blnVariableName = False

and if there are several of them just do a loop as either Tom or I have
demonstrated.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"edisonl via AccessMonster.com" u47544@uwe wrote in message
news:9d53874a5a97f@uwe...
Hi Tom,

Sorry I may have not explain myself clearly.

What I wanted to achieve was to set Boolean that is declared as public
variable within a form in VB editor as False on exit or Form_Load

Regards, Edison

Tom van Stiphout wrote:
Easier to do all checkboxes:
dim ctl as control
for each ctl in me.controls
if typeof(ctl) is checkbox then
ctl.value = false
endif
next

-Tom.
Microsoft Access MVP

Hi,

any idea how can I explicitly set all Boolean Datatype within a form to
FALSE
with a On_Click Button ?

Regards, Edison


--
Message posted via http://www.accessmonster.com



 




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 11:41 AM.


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