I have this code which converts a 11 digit number into an 8 digit hex number.
left3 = Left([txtESNdec], 3)
right8 = Right([txtESNdec], 8)
hexleft = Hex(left3)
hexright = Hex(right8)
hex_number = hexleft & Format(hexright, "000000")
Me.[txtESNHEX] = hex_number
Me.txtDateCode.SetFocus
Everything works perfectly, except in the one instance where the "hexright" value comes out with a zero for its first number.
For example, if hexleft = 1E and hexright = 20ED1A, then I get the result of 1E20ED1A and thats exactly right. But in the one instance where the hexright value starts with a zero, I get: hexleft = 1E, hexright = 02ED1A, then I get a result of 1E2ED1A, even with the "format(hexright, "000000") line.
I used this same code before for my decimal conversions and it worked for that, so I am not sure why this one isn't working.
thanks for the help in advance guys!
Richard
left3 = Left([txtESNdec], 3)
right8 = Right([txtESNdec], 8)
hexleft = Hex(left3)
hexright = Hex(right8)
hex_number = hexleft & Format(hexright, "000000")
Me.[txtESNHEX] = hex_number
Me.txtDateCode.SetFocus
Everything works perfectly, except in the one instance where the "hexright" value comes out with a zero for its first number.
For example, if hexleft = 1E and hexright = 20ED1A, then I get the result of 1E20ED1A and thats exactly right. But in the one instance where the hexright value starts with a zero, I get: hexleft = 1E, hexright = 02ED1A, then I get a result of 1E2ED1A, even with the "format(hexright, "000000") line.
I used this same code before for my decimal conversions and it worked for that, so I am not sure why this one isn't working.
thanks for the help in advance guys!
Richard