Here's my guess...

You have all of the variables - TenThousand, Thousand, Hundred etc. declared as BIT instead of BYTE?

Code:
DEC             3     2     2     6     4
BIN          0011  0010  0010  0110  0100
Bitvar          1     0     0     0     0
multiplier 10,000 1,000   100    10     1
           ------ -----  ----  ----  ----
           10,000     0     0     0     0
    HEX =    2710h

DEC             0     3     2     0
BIN          0000  0011  0010  0000
Bitvar          0     1     0     0
multiplier  1,000   100    10     1
           ------ -----  ----  ----
                0   100     0     0
    HEX =    0064h