I want to check last prod. order no. vs current and if they are different input it into temp table. And statement in attached photo is false, but somehow it gets interpreted as true, when both prod.order no. are same. Why this is happening?
There is 2 loops and when it gets out of first loop I want to make that check in debugger window at right you can see those two variables being the same. And I get error when it tries to write to my temp table because record already exist and my statement lastentry <> prod order no. was accepted as true when in reality they are both same and it shouldn't be true.
Your code will not work if there will be records like this:
Order 1
Order 2
Order 1 // Last Entry = Order 2, bit Order 1 is already saved in temp table and you will get an error.
Answers
You check only first record.
You have to move this check into the loop:
Your code will not work if there will be records like this:
Order 1
Order 2
Order 1 // Last Entry = Order 2, bit Order 1 is already saved in temp table and you will get an error.