Check Box to Gray Out Areas

Hi Mr. Larson. Now that i have spent more time with this I now understand why using the modified code is a good idea. My VBA window is long and clunky (would this inhibit speed and performance?)
What you suggested now makes sense. My question is where do I put this code? I have four checkboxes on my form that activate different fields. Would this go in "after update" for each checkbox?

Re: Check Box to Gray Out Areas
Okay here you go. First I put the word BusOp into the TAG property of each of the controls we want enabled/disabled by the checkbox. That property is found by selecting the control and clicking on the OTHER tab in the properties dialog. Next I modified the form's code to have a new function in it:

Code:
Function SetBusOp() Dim ctl As Control For Each ctl In Me.Controls If ctl.Tag = "BusOp" Then ctl.Enabled = Me.PropBusOwnDIFF End If Next End Function
And then I call that in the checkbox After Update event and in the On Current event:
Code:
SetBusOp
 
I dont know why the pasted text did not work...it is from this thread #12. Thank you.
 
I dont know why the pasted text did not work...it is from this thread #12. Thank you.

Define "did not work." What happened?

Also, in one of your other threads gemma-the-husky suggested this change (to handle null values of the checkbox):
Code:
Function SetBusOp()
Dim ctl As Control

For Each ctl In Me.Controls
    If ctl.Tag = "BusOp" Then
        ctl.Enabled = [B][COLOR=red]Nz([/COLOR][/B]Me.PropBusOwnDIFF[B][COLOR=red], False)[/COLOR][/B]
    End If
Next
End Function
 
Hi I highlighted the text...copy...paste and it did not paste as it has in the past. ?

In any case I dont know which window to paste this in for the Event Procedure of each checkbox? After Update? Thank you sir!
 
Hi I highlighted the text...copy...paste and it did not paste as it has in the past. ?
You may need to highlight and use CTRL+C to copy and then CTRL+V to paste.
In any case I dont know which window to paste this in for the Event Procedure of each checkbox? After Update? Thank you sir!
So you have more than one checkbox you are using to determine whether to show the BusOp controls? Doesn't make sense to me.

The function just pastes into the form's module (not in any event) and then in the after update event of the PropBusOwnDIFF checkbox you would put:

If used in the After Update event in the VBA window: SetBusOp

If used in the After Update event in the control's properties - =SetBusOp()

Either should be able to be used but don't use them both at the same time. I prefer to use the VBA Window myself.
 

Users who are viewing this thread

Back
Top Bottom