Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2004

    Unanswered: Counting number of text boxes with same numeric value

    Hello All,

    I need help in counting the number of text boxes with the same value on a form. For example, I have six text boxes where the calculated control on the text box brings a "0" value and two text boxes bring a "-1" value.

    I want to have two text boxes (at the bottom of the form) where I count the number of "0" values in one text box and the number of "-1" values in the other text box.

    I'm assuming this is fairly simple, but I can't find the answer.

    Thanks for anyone's help!

  2. #2
    Join Date
    Jul 2003
    Something like...

    Dim ctl As Control
    For Each ctlLine In Me.Controls
      If ctl.ControlType = acTextBox Then
        If ctl.Value = -1 Then
            'do your thing here
        End If
      End If
    That loops thru every control on your form, looking for text boxes
    equal to "-1". I suppose if you have too many controls on the form, this may be slow.
    Inspiration Through Fermentation

  3. #3
    Join Date
    Mar 2003
    The Bottom of The Barrel
    Provided Answers: 1
    Will you always be evaluating for -1 or 0?
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

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