access中自定义函数十进制十六进制之间的转换
时 间:2018-05-08 10:18:11
作 者:鸵鸟 ID:39610 城市:中山
摘 要:进制间转换
正 文:
十进制转换为十六进制:
Public Function DecHex(lngDecimal As Long)
Dim lngQout As LongDim 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
十六进制转换为十进制
Public Function HexDec(strHexadecimal As String)
Dim intl As Integer
Dim lngDecimal As Long
Dim i As Integer
Dim s As Integer
intl = Len(strHexadecimal)
s = 0
For i = intl To 1 Step -1
SS = Mid(strHexadecimal, i, 1)
Select Case SS
Case 0
SS = SS
Case 1
SS = SS
Case 2
SS = SS
Case 3
SS = SS
Case 4
SS = SS
Case 5
SS = SS
Case 6
SS = SS
Case 7
SS = SS
Case 8
SS = SS
Case 9
SS = SS
Case "A"
SS = 10
Case "B"
SS = 11
Case "C"
SS = 12
Case "D"
SS = 13
Case "E"
SS = 14
Case "F"
SS = 15
End Select
lngDecimal = lngDecimal + SS * 16 ^ s
s = s + 1
Next
HexDec = lngDecimal
End Function
Access软件网官方交流QQ群 (群号:54525238) Access源码网店
常见问答:
技术分类:
源码示例
- 【源码QQ群号19834647...(12.17)
- Access对子窗体数据进行批...(10.30)
- 最精简的组合框行来源数据快速输...(10.25)
- Access仿平台的多值选择器...(10.24)
- 【Access日期区间段查询】...(10.22)
- 【Access源码示例】VBA...(10.12)
- Access累乘示例,Acce...(10.09)
- 数值8.88,把整数8去掉,转...(10.08)
- 【Access自定义函数】一个...(09.30)
- 【Access选项卡示例】Ac...(09.09)
学习心得
最新文章
- 微软Access邀测新Monaco...(11.12)
- Access列表框左右互选、列表框...(11.11)
- 高效率在导入数据前删除记录(11.10)
- Access报价单转订单示例代码(11.08)
- Access系统自带的日期选择器不...(11.08)
- 分享一下Access工程中的acw...(11.07)
- Access快速开发平台--让有权...(11.04)
- Access快速开发平台--审批选...(11.01)
- ACCESS两张表先各自排序,然后...(10.31)
- Access对子窗体数据进行批量+...(10.30)