Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Check box to disable command button

Discussion in 'Information Technology' started by cathywoodford@personainternet.com, Jul 28, 2006.

  1. cathywoodford@personainternet.com

    Guest

    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
     
  2. Loading...


  3. fredg

    fredg
    Expand Collapse
    Guest

    On 20 Jun 2006 12:00:01 -0700, cathywoodford@personainternet.com
    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
     
  4. Ron2006

    Ron2006
    Expand Collapse
    Guest

    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.
     
  5. cathywoodford@personainternet.com

    Guest

    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, cathywoodford@personainternet.com
    > 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
     
  6. fredg

    fredg
    Expand Collapse
    Guest

    On 21 Jun 2006 04:03:22 -0700, cathywoodford@personainternet.com
    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, cathywoodford@personainternet.com
    >> 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
     
  7. cathywoodford@personainternet.com

    Guest

    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
     
  8. fredg

    fredg
    Expand Collapse
    Guest

    On 21 Jun 2006 08:51:43 -0700, cathywoodford@personainternet.com
    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
     
  9. cathywoodford@personainternet.com

    Guest

    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
     

Share This Page