Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Jan 2005
    Location
    Wichita, Kansas, USA
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Check box expression (2000)

    I have a form with 20 different items that can be ordered--all as checkboxes for yes or no. There are corresponding textboxes with the charge for each item. Third, there are a series of check boxes corresponding to each item to show whether or not they have been paid. Most people pay off all ordered items at once, so I would like to have a check box that would automatically look at each item ordered and when I check that Box, it would automatically check all of the corresponding "Paid" checkboxes, rahter than having to do each box individually. Hope that makes some sense...any help is appreciated.

  2. #2
    2 Star Lounger
    Join Date
    Jan 2005
    Location
    Wichita, Kansas, USA
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Check box expression (2000)

    Thanks again--man, you're good! Can I get you something for Christmas, or double your salary or something?

    It all works except the four fields that are quantity fields with a default value of zero, so that rather than a checkbox (yes, I did, or no, I did not order thatn item), there is a text filed to indicate the number of DVDs ordered. I was trying something like:

    If Me.StuVHSOrd.Value > 0 Then
    Me.StuVidPaid = True
    End If
    If Me.CerVHSOrd.Value > 0 Then
    Me.CerVidPaid = True
    End If

    but that doesn't work... So, again I bow and defer to your wisdom...

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Check box expression (2000)

    You could use code in the After Update event or On Click event of the check box. The exact code depends on whether there is a system to the naming of the "Paid" check boxes. If not, you have to list them individually:

    Private Sub chkAllPaid_AfterUpdate()
    If Me.chkAllPaid = True Then
    Me.chkDVDPaid = True
    Me.chkVHSPaid = True
    ...
    End If
    End Sub

    For consistency, you'd have to clear this check box if one of the "Paid" check boxes is cleared:

    Private Sub chkDVDPaid_AfterUpdate()
    If Me.chkDVDPaid = False Then
    Me.chkAllPaid = False
    End If
    End Sub

    and similar for the others. It might be less work to use a command button instead of a check box.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Check box expression (2000)

    I'm sorry, I don't understand. What exactly are you trying to accomplish now?

  5. #5
    2 Star Lounger
    Join Date
    Jan 2005
    Location
    Wichita, Kansas, USA
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Check box expression (2000)

    Sorry...
    In getting the "Check All" checkbox working...it all works except,

    Four of the fields are not checkboxes, but rather textboxes indicating the number of DVDs ordered, so rather than the "= True" which works for the checkboxes, I need to use something like "not 0" or ">0" or something, simply to indicate whether or not that item was ordered.

    Here is a sample of the code that does work (the ones with the checkboxes):
    Private Sub chkAllPaid_Click()
    If Me.chkAllPaid = True Then
    If Me.PartFeeOrdered = True Then
    Me.PartFeePaid = True
    End If
    If Me.LatePartFeeOrd = True Then
    Me.LatePartFeePaid = True
    End If
    If Me.CapGownOrd = True Then
    Me.CapGownPaid = True
    End If

    The code I tried for those fields with textboxes was this (but it doesn't work):

    If Me.StuVHSOrd.Value > 0 Then
    Me.StuVidPaid = True
    End If
    If Me.CerVHSOrd.Value > 0 Then
    Me.CerVidPaid = True
    End If
    If Me.StuDVDOrd.Value > 0 Then
    Me.StuVidPaid = True
    End If
    If Me.CerDVDOrd.Value > 0 Then
    Me.CerVidPaid = True
    End If

    End If

    Hope that makes some sense...

    Warren

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Check box expression (2000)

    It seems to me that in

    If Me.StuDVDOrd.Value > 0 Then
    Me.StuVidPaid = True
    End If
    If Me.CerDVDOrd.Value > 0 Then
    Me.CerVidPaid = True
    End If

    you are using the wrong names for the check boxes - shouldn't they be StuDVDPaid and CerDVDPaid?

    Apart from that, what do you mean by "doesn't work"?
    - Do you get an error? If so, what is the error message?
    - Does it produce an undesired result? If so, what is the result and what should it have been?
    - Does it do nothing at all?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •