From: Jen on
Hi Guys,
I'm trying to grey out a control on a form when a check is put in a
checkbox. I know there's been a couple of similar threads already and i've
actually got the control to become greyed out but when i open the form again
later, the control is no longer greyed out even though the checkmark is still
in the box.

Anybody know what i'm doing wrong ?. Any help would be great.

Thanks,
Jen

Ps...Apologies if this is a double post but the previous one doesn't seem to
have worked

From: Dirk Goldgar on
"Jen" <Jen(a)discussions.microsoft.com> wrote in message
news:D967D0BF-2000-4B85-92F8-E54202F9D3F8(a)microsoft.com...
> Hi Guys,
> I'm trying to grey out a control on a form when a check is put in a
> checkbox. I know there's been a couple of similar threads already and i've
> actually got the control to become greyed out but when i open the form
> again
> later, the control is no longer greyed out even though the checkmark is
> still
> in the box.
>
> Anybody know what i'm doing wrong ?. Any help would be great.
>
> Thanks,
> Jen
>
> Ps...Apologies if this is a double post but the previous one doesn't seem
> to
> have worked


I see your earlier message.

You probably need to use the form's Current event to apply whatever logic
greys out the control, as well as using the check box's AfterUpdate event.
For example,

Private Sub chkYourCheckbox_AfterUpdate()

Me.YourOtherControl.Enabled = Not Me.chkYourCheckbox

End Sub

Private Sub Form_Current()

Me.YourOtherControl.Enabled = Not Me.chkYourCheckbox

End Sub



--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

From: fredg on
On Tue, 5 Jan 2010 07:22:01 -0800, Jen wrote:

> Hi Guys,
> I'm trying to get a control on a form to become greyed out when i tick a
> check box.I know there's been a couple of threads on this before and i've
> actually got it to work but when i open the form again the control is no
> longer greyed out, even though the checkbox still has the check mark in it ??
>
> Any help would be great,
> Thanks everyone,
> Jen

It would have been helpful for you to let us know what your code
actually is to "grey out" the control, so as not to just tell you to
do the same thing as is now not working.

The following should work.
You need top place the below code in 2 places.
Place this code in the Check Box AfterUpdate event as well as the
Form's Current event:

Me.[ControlName].Enabled = (Me.[CheckBoxName] = 0)

Substitute your actual control names.

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
From: Jen32 on
Hi Fred,
Thanks for the reply. I tried your suggestion and it worked fine in the
AfterUpdate event of the check box, but when i put it the the Form's current
event and run it i get a message saying 'Run-time Error 94;' Invalid use of
Null.

Then when i click Debug i get the following code highlighted in yellow

Me.[Manager].Enabled = (Me.[Check39] = 0)

I tried this code with the square brackets in and out and neither worked

Thanks,
Jen

fredg wrote:
>> Hi Guys,
>> I'm trying to get a control on a form to become greyed out when i tick a
>[quoted text clipped - 5 lines]
>> Thanks everyone,
>> Jen
>
>It would have been helpful for you to let us know what your code
>actually is to "grey out" the control, so as not to just tell you to
>do the same thing as is now not working.
>
>The following should work.
>You need top place the below code in 2 places.
>Place this code in the Check Box AfterUpdate event as well as the
>Form's Current event:
>
>Me.[ControlName].Enabled = (Me.[CheckBoxName] = 0)
>
>Substitute your actual control names.
>

From: fredg on
On Tue, 05 Jan 2010 19:24:42 GMT, Jen32 wrote:

> Hi Fred,
> Thanks for the reply. I tried your suggestion and it worked fine in the
> AfterUpdate event of the check box, but when i put it the the Form's current
> event and run it i get a message saying 'Run-time Error 94;' Invalid use of
> Null.
>
> Then when i click Debug i get the following code highlighted in yellow
>
> Me.[Manager].Enabled = (Me.[Check39] = 0)
>
> I tried this code with the square brackets in and out and neither worked
>
> Thanks,
> Jen
>
> fredg wrote:
>>> Hi Guys,
>>> I'm trying to get a control on a form to become greyed out when i tick a
>>[quoted text clipped - 5 lines]
>>> Thanks everyone,
>>> Jen
>>
>>It would have been helpful for you to let us know what your code
>>actually is to "grey out" the control, so as not to just tell you to
>>do the same thing as is now not working.
>>
>>The following should work.
>>You need top place the below code in 2 places.
>>Place this code in the Check Box AfterUpdate event as well as the
>>Form's Current event:
>>
>>Me.[ControlName].Enabled = (Me.[CheckBoxName] = 0)
>>
>>Substitute your actual control names.
>>

What happens if you use:

Me.[Manager].Enabled = (Nz(Me.[Check39] ,0)= 0)
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail