lparameters tnValue, ; tnPlaces local lnPlaces, ; lcHex, ; lnDecimal, ; lnCurrDecimals, ; lnPlaces, ; lnI, ; lnExponent, ; lnTemp, ; lcOut lnPlaces = iif(pcount() = 1, 4, tnPlaces) lcHex = '' lnDecimal = tnValue lnCurrDecimals = set('DECIMALS') lnPlaces = iif(pcount() = 1, 4, tnPlaces) set decimals to 17 for lnI = lnPlaces to 1 step -1 lnExponent = 256 ^ (lnI - 1) lnTemp = int(lnDecimal/lnExponent) lcHex = lcHex + chr(lnTemp) lnDecimal = lnDecimal - lnTemp * lnExponent next lnI set decimals to lnCurrDecimals * Reverse the order of the characters. lcOut = '' for lnI = 1 to lnPlaces lcOut = lcOut + substr(lcHex, lnPlaces - lnI + 1, 1) next lnI return lcOutDoug