Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Runtime Error 6

Status
Not open for further replies.

Chummly1984

Technical User
Sep 8, 2007
11
US
I am using this code, and am getting this error.

If Len(txtESNdec) = 18 Then
left10 = Left([txtESNdec], 10)
right8 = Right([txtESNdec], 8)
hexleft = Hex(left10)
hexright = Hex(right8)
hex_number = Format(hexleft, "00000000") & Format(hexright, "000000")
Me.txtESNhex = hex_number
End If

The Lexleft = Hex(left10) is the one causing the error. The txtESNdec is set to 268435456200770330 and the left10 variable shows 2684354562, but is the hex conversion limited to a particular size number?

thanks guys!
 
Never mind, I changed it to "Val "&H" & Left10" and it worked fine.

thanks anyways!
 
Opps, spoke too soon guys. I am still having the issue. The prev msg was wrong and it is not working as well.

Any ideas per the code in the original message?
 
It seems so. Help states:

[tt]If number is Hex returns
Null Null
Empty Zero (0)
Any other number Up to eight hexadecimal characters[/tt]
 
Well, that was a big help Remou.

Considering I do have a 10 digit Decimal number, trying to convert it to an 8 digit hex number, the help really doesnt answer the question. Is there a limit in regards to the largest number the hex function will convert?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top