PC Review


Reply
Thread Tools Rate Thread

Check box to disable command button

 
 
cathywoodford@personainternet.com
Guest
Posts: n/a
 
      20th Jun 2006
Hi. I have a check box that is part of SubformA on MainFormA. I want
to disable a command button that is on MainFormA if the check box is
checked and enable it if the check box is not checked.

Any ideas?

Thanks,
Cathy

 
Reply With Quote
 
 
 
 
fredg
Guest
Posts: n/a
 
      20th Jun 2006
On 20 Jun 2006 12:00:01 -0700, (E-Mail Removed)
wrote:

> Hi. I have a check box that is part of SubformA on MainFormA. I want
> to disable a command button that is on MainFormA if the check box is
> checked and enable it if the check box is not checked.
>
> Any ideas?
>
> Thanks,
> Cathy


Code the check box AfterUpdate event:
Me.Parent.CommandButtonName.Enabled = Not Me![CheckBoxName]

In the main form's Current event, write:
Me.CommandButtonName.Enabled = Not
Me.SubfrmDetails.Form.[CheckBoxName]

where SubfrmDetails is the name of the subform control on the main
form.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
 
Reply With Quote
 
Ron2006
Guest
Posts: n/a
 
      20th Jun 2006
Remember, this makes the mainform button dependent on the value in the
first record of the subform (until you change records in the subform
and then it will change based on those records, one by one.

 
Reply With Quote
 
cathywoodford@personainternet.com
Guest
Posts: n/a
 
      21st Jun 2006
Hi Fred. Thanks for the reply. Now the command button is disabled no
matter what the check box is.

MainFrom = frmMovie
Subform with just the rented checkbox = frmRental_subform

I don't know if this makes a difference or not but the rental subform
only shows if the checkbox on the subform is checked. If the movie is
not rented then the check box doesn't show and that's when I would like
to have the command button enabled so the user can rent the movie.

Thanks,
Cathy
fredg wrote:
> On 20 Jun 2006 12:00:01 -0700, (E-Mail Removed)
> wrote:
>
> > Hi. I have a check box that is part of SubformA on MainFormA. I want
> > to disable a command button that is on MainFormA if the check box is
> > checked and enable it if the check box is not checked.
> >
> > Any ideas?
> >
> > Thanks,
> > Cathy

>
> Code the check box AfterUpdate event:
> Me.Parent.CommandButtonName.Enabled = Not Me![CheckBoxName]
>
> In the main form's Current event, write:
> Me.CommandButtonName.Enabled = Not
> Me.SubfrmDetails.Form.[CheckBoxName]
>
> where SubfrmDetails is the name of the subform control on the main
> form.
> --
> Fred
> Please respond only to this newsgroup.
> I do not reply to personal e-mail


 
Reply With Quote
 
fredg
Guest
Posts: n/a
 
      21st Jun 2006
On 21 Jun 2006 04:03:22 -0700, (E-Mail Removed)
wrote:

> Hi Fred. Thanks for the reply. Now the command button is disabled no
> matter what the check box is.
>
> MainFrom = frmMovie
> Subform with just the rented checkbox = frmRental_subform
>
> I don't know if this makes a difference or not but the rental subform
> only shows if the checkbox on the subform is checked. If the movie is
> not rented then the check box doesn't show and that's when I would like
> to have the command button enabled so the user can rent the movie.
>
> Thanks,
> Cathy
> fredg wrote:
>> On 20 Jun 2006 12:00:01 -0700, (E-Mail Removed)
>> wrote:
>>
>>> Hi. I have a check box that is part of SubformA on MainFormA. I want
>>> to disable a command button that is on MainFormA if the check box is
>>> checked and enable it if the check box is not checked.
>>>
>>> Any ideas?
>>>
>>> Thanks,
>>> Cathy

>>
>> Code the check box AfterUpdate event:
>> Me.Parent.CommandButtonName.Enabled = Not Me![CheckBoxName]
>>
>> In the main form's Current event, write:
>> Me.CommandButtonName.Enabled = Not
>> Me.SubfrmDetails.Form.[CheckBoxName]
>>
>> where SubfrmDetails is the name of the subform control on the main
>> form.
>> --
>> Fred
>> Please respond only to this newsgroup.
>> I do not reply to personal e-mail


1) Did you understand this part of my reply?
> where SubfrmDetails is the name of the subform control on the main

form. <

SubfrmDetails is NOT the name of the form used as the sub form, but
the name of the control on the main form that holds the form that is
the sub form, i.e. the name of the control that you dragged onto the
main form from the tool box when you added the sub form to the main
form. You must change my SubfrmDetails to whatever your actual sub
form control name is.

2) Did you also code the main form Current event (and change the
control names to your actual control names)?

3) Is the check box bound to a field?

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
 
Reply With Quote
 
cathywoodford@personainternet.com
Guest
Posts: n/a
 
      21st Jun 2006
Hi Fred.

1. Do you mean ie: "Child 18"? I don't know where to find that name
now. when I go to the properties of the "subform" it has the name
frmRental_subform? Where would I find this now?

2.Yes I did put this code in and change to my control names.

3. The check box has a control source of the rented field from
tblRental.

When I dragged the subform to the main form I follwed the instructions
step by step.

Thanks,
Cathy


> 1) Did you understand this part of my reply?
> > where SubfrmDetails is the name of the subform control on the main

> form. <
>
> SubfrmDetails is NOT the name of the form used as the sub form, but
> the name of the control on the main form that holds the form that is
> the sub form, i.e. the name of the control that you dragged onto the
> main form from the tool box when you added the sub form to the main
> form. You must change my SubfrmDetails to whatever your actual sub
> form control name is.
>
> 2) Did you also code the main form Current event (and change the
> control names to your actual control names)?
>
> 3) Is the check box bound to a field?
>
> --
> Fred
> Please respond only to this newsgroup.
> I do not reply to personal e-mail


 
Reply With Quote
 
fredg
Guest
Posts: n/a
 
      21st Jun 2006
On 21 Jun 2006 08:51:43 -0700, (E-Mail Removed)
wrote:

> Hi Fred.
>
> 1. Do you mean ie: "Child 18"? I don't know where to find that name
> now. when I go to the properties of the "subform" it has the name
> frmRental_subform? Where would I find this now?
>
> 2.Yes I did put this code in and change to my control names.
>
> 3. The check box has a control source of the rented field from
> tblRental.
>
> When I dragged the subform to the main form I follwed the instructions
> step by step.
>
> Thanks,
> Cathy
>
>> 1) Did you understand this part of my reply?
>>> where SubfrmDetails is the name of the subform control on the main

>> form. <
>>
>> SubfrmDetails is NOT the name of the form used as the sub form, but
>> the name of the control on the main form that holds the form that is
>> the sub form, i.e. the name of the control that you dragged onto the
>> main form from the tool box when you added the sub form to the main
>> form. You must change my SubfrmDetails to whatever your actual sub
>> form control name is.
>>
>> 2) Did you also code the main form Current event (and change the
>> control names to your actual control names)?
>>
>> 3) Is the check box bound to a field?
>>
>> --
>> Fred
>> Please respond only to this newsgroup.
>> I do not reply to personal e-mail


Yes, when you add a subform control to a form, the default name of the
control is "Child?" so it may have been Child18 on your form. You may
have renamed it "frmRental_subform" and that is the correct name to
use (as long as that is not the name of the actual form used as the
subform).

What I gave you works for me.

If you still have a problem, without actually seeing your set-up I
don't believe I can help any further.

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
 
Reply With Quote
 
cathywoodford@personainternet.com
Guest
Posts: n/a
 
      21st Jun 2006
I can't remember the name of the control when I put it on the form. I
followed the instructions and choose the rental table and the fields
that I wanted on the form. On the last screen of the setup I just
automatically accepted the name that it gave and that's the one I am
using in the code. Would that be correct?

Cathy


fredg wrote:
>
> Yes, when you add a subform control to a form, the default name of the
> control is "Child?" so it may have been Child18 on your form. You may
> have renamed it "frmRental_subform" and that is the correct name to
> use (as long as that is not the name of the actual form used as the
> subform).
>
> What I gave you works for me.
>
> If you still have a problem, without actually seeing your set-up I
> don't believe I can help any further.
>
> --
> Fred
> Please respond only to this newsgroup.
> I do not reply to personal e-mail


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable Command Button DeanT Microsoft Access Form Coding 13 24th Jan 2008 11:17 PM
Disable Command Button mdavis via AccessMonster.com Microsoft Access Forms 10 18th Dec 2006 10:17 PM
Disable Command Button =?Utf-8?B?UmFq?= Microsoft Excel Programming 1 10th Mar 2006 05:01 AM
Disable command button Mikeice Microsoft Excel Programming 2 17th Jun 2005 10:17 AM
Disable Command Button Daniel Microsoft Access Form Coding 2 29th Oct 2003 08:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:43 PM.