Is there a way to do this?

  • Thread starter Thread starter Emilio
  • Start date Start date
E

Emilio

Hi,
I have a form with a check box call "JobReady", and a
subform with many items and a check box called "Ready".

Is there a way to turn "JobReady" "ON" automatically when
all the items on the subform "Ready" check box are "ON"?

Right now I am depending on the user to do it and sometimes
they forget.
Any help is greatly appreciated.

Emilio
 
Emilo,

If you create a control in the footer of the sub form (I would initially
give it some vertical height, but once this is working, I would make the
controls height = 0 and the footers height also equal to zero).

In that control (we will call it txt_ReadySum) , enter the control source
as:

=SUM(1+[Ready])

If a [Ready] value is checked, then 1 + [Ready] will equal 0. If all the
values are checked, the value in this control will be zero, otherwise, the
value will have some positive value. In the onclick event of the [Ready]
checkboxes, enter some code that will set the value of the [JobReady] check
box. Something like:

Private Sub chk_Ready_Click()

me.parent.form.chk_JobReady = iif(me.txtReadySum = 0, -1, 0)

end sub

HTH
Dale
 
Thanks a lot Dale for your help.

However, I can't get it to work.
I forgot to mention that "JobReady" is in another Subform
of the "Schedule Info" form called "Schedule Info
subform2", so this is how I referred to the control "JobReady":

Forms![Schedule Info]![Schedule Info
subform2].Form![JobReady] = IIf(Me.txtReadySum = 0, -1, 0)

(is this OK?)

Also I didn't realize that the Subform where "Ready" is
located is set to "Allow Additions" so there will always be
another "Ready" checkbox unchecked (I think I know how to
get around that by invoking the Null on another control)
In any case for the purpose of testing I turned "Allow
Additions" OFF.

I hope is clear enough.

By the way thanks for explaining everything in detail, one
thing you propably read between the lines is that I am a
newbie.

Thanks again,
Emilio
-----Original Message-----
Emilio,

If you create a control in the footer of the sub form (I would initially
give it some vertical height, but once this is working, I would make the
controls height = 0 and the footers height also equal to zero).

In that control (we will call it txt_ReadySum) , enter the control source
as:

=SUM(1+[Ready])

If a [Ready] value is checked, then 1 + [Ready] will equal 0. If all the
values are checked, the value in this control will be zero, otherwise, the
value will have some positive value. In the onclick event of the [Ready]
checkboxes, enter some code that will set the value of the [JobReady] check
box. Something like:

Private Sub chk_Ready_Click()

me.parent.form.chk_JobReady = iif(me.txtReadySum = 0, -1, 0)

end sub

HTH
Dale

Hi,
I have a form with a check box call "JobReady", and a
subform with many items and a check box called "Ready".

Is there a way to turn "JobReady" "ON" automatically when
all the items on the subform "Ready" check box are "ON"?

Right now I am depending on the user to do it and sometimes
they forget.
Any help is greatly appreciated.

Emilio


.
 
Back
Top