Results 1 to 3 of 3
  1. #1
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Continuous Form Calc (2002 SP-2)

    <img src=/S/brickwall.gif border=0 alt=brickwall width=25 height=15>
    In a txtbx in the footer of a continuous form I'm trying to calculate the sum of one txtbx based on the value of another txtbx (both are in the detail section). I've tried a number of different ways, but I'm completely lost at this point.
    txtLiquidLoads = Sum[txtBrokerNet] If [txtEquipmentType]= Like"Liq*"
    That, of course, isn't what I have in the control source, but what I want it to do. In other words, I want to get the "BrokerNet" for only those loads that have "Liq" in a part of the EquipmentType txtbx. I'll be right back; gone to take some aspirin
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

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

    Re: Continuous Form Calc (2002 SP-2)

    Try
    <pre>=Sum(IIf([txtEquipmentType] Like "Liq*",[txtBrokerNet],0)
    </pre>

    or
    <pre>=-Sum(([txtEquipmentType] Like "Liq*")*[txtBrokerNet])
    </pre>

    The latter uses the fact that True = -1.

    Note: like your demo code, this tests whether txtEquipmentType starts with Liq. If you want to test whether Liq is part of it, as you state in the description, use Like "*Liq*" instead of Like "Liq*".

  3. #3
    5 Star Lounger bfxtrfcmgr's Avatar
    Join Date
    Aug 2002
    Location
    Fresno, California, USA
    Posts
    995
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Re: Continuous Form Calc (2002 SP-2)

    Hans:

    Perfect! (And also explains why =IIf([txtEquipmentType] Like "Liq*", Sum ([BrokerNetCalc],0)) doesn't work <img src=/S/grin.gif border=0 alt=grin width=15 height=15> THANKS!!
    Bryan,
    Not the smartest critter on the glacier. . .
    . . .but I'm persistent (does that count?)

Posting Permissions

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