# Change Hex Number To Dec Number

• Hi there

I want to change a Hex number to dec number in ms access, how can i do that?
in excel, just apply =hex2dec(range), .

cheers
Mohsin

• Re: Change Hex Number To Dec Number

In detail;

My value = 319,A03,B13,16, which is in text format. The numbers actually are
in hex value. What i need to do now is, convert the value from text to hex
then to decimal,

i'm using below expression for converting to hex, but is wrong..:)

CCDec: Val(Replace([tblclearcode]![CLEARCODE_ID],",",""))

Thank you
Mohsin

• Re: Change Hex Number To Dec Number

Are you wanting a query result where you select the text field to be represented as a Hex? Is this code to store a Hex number in a table from a textbox on a form? Please explain the context of where you want the conversion to take place.

• Re: Change Hex Number To Dec Number

Hi

Yes, text field to hex format..

thank you

• Re: Change Hex Number To Dec Number

There has to be a better way to do this but for the interim, this works:

• Re: Change Hex Number To Dec Number

I had a similar problem of needing to convert hex2dec or dec2hex. application had to determine which coversion was needed on a case by case basis. It is part of an old inventory receiving program for Cell phone. Cell phones used to have HEX & DEC Electronic Serial Numbers. Now they are using IMEI so I don't believe this bit of code what you want but may give some insite...

the HEXESN is always 8 digits
the DECESN is always 11 digits
the first 2 HEX digits equate to the first 3 digits in the DEC

• Re: Change Hex Number To Dec Number

This may help:

[SIZE=1]Entia non sunt multiplicanda sine necessitate.[/SIZE]

• Re: Change Hex Number To Dec Number

The code I pasted last week had a bug. This may be OBE, but here's a correction.

[SIZE=1]Entia non sunt multiplicanda sine necessitate.[/SIZE]

## Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!