IF llFoundPrefix * found it - save the rate we found! <strong>I think your problem is right here</strong> lnResult = long_distance.rate * The problem is that your table has Rate1, rate2, rateN * but you are referring to simply Rate. ELSE ...