haha. This is funny. I had no idea you do use this formula to validate whether a UPC is valid. Cool.
Here is a formula I would use. I'm not testing this, so there is probably a small bug. But I'm taking what you said and just writing what I would do off the top of my head. It should be pretty close the final version and you can tweak it accordingly. Here you go...
((((Val(Mid({table.UPC}, 1)) + Val(Mid({table.UPC}, 3)) + Val(Mid({table.UPC}, 5)) + Val(Mid({table.UPC}, 7)) +
Val(Mid({table.UPC}, 9)) + Val(Mid({table.UPC}, 11))) * 3)
+ (Val(Mid({table.UPC}, 2)) + Val(Mid({table.UPC}, 4)) + Val(Mid({table.UPC}, 6)) + Val(Mid({table.UPC}, 8)) + Val(Mid({table.UPC}, 10)))
+ Val(Mid({table.UPC}, 12))) MOD 10) = 0
Man, there's like a hundred parentheses in this. I'm sure I screwed a few of them up. So you'll have to double check that they are all in place and that an openning parentheses has a matching closing parentheses. But overall this should be pretty good.
My Encyclopedia book has three chapters dedicated to helping you learn how to write formulas and gives sample code with it. You can find out more about my books at
Amazon.com or reading the
Crystal Reports eBooks online.