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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|