在Access中通过自定义函数将十进制转换成十六进制。
Public Function DecHex(lngDecimal As Long)
Dim lngQout As Long
Dim strTmp As String
Dim intTmp As Integer
lngQout = lngDecimal
Do Until lngQout = 0
intTmp = lngQout Mod 16
Select Case intTmp
Case Is <= 9
strTmp = intTmp & strTmp
Case 10
strTmp = "A" & strTmp
Case 11
strTmp = "B" & strTmp
Case 12
strTmp = "C" & strTmp
Case 13
strTmp = "D" & strTmp
Case 14
strTmp = "E" & strTmp
Case 15
strTmp = "F" & strTmp
End Select
lngQout = Int(lngQout / 16)
Loop
DecHex = strTmp
End Function
例:输入 DecHex (1024) 转换出来的结果就是十六进制:400。