获取全球唯一编码(GUID)的方法
时间:2008-12-20 09:58 来源:本站原创 作者:佚名 阅读:次
Private Type GUID
Data1 As Long
Data2 As Long
Data3 As Long
Data4(8) As Byte
End Type
Private Declare Function CoCreateGuid Lib "ole32.dll" ( _
pguid As GUID) As Long
Private Declare Function StringFromGUID2 Lib "ole32.dll" ( _
rguid As Any, _
ByVal lpstrClsId As Long, _
ByVal cbMax As Long) As Long
自定义一个函数
Public Function GetNewGuild() As String
Dim g As GUID
Dim b() As Byte
Dim lSize As Long
Dim lR As Long
CoCreateGuid g
lSize = 40
ReDim b(0 To (lSize * 2) - 1) As Byte
lR = StringFromGUID2(g, VarPtr(b(0)), lSize)
GetNewGuild = Left$(b, lR - 1)
End Function
也可使用access本身字段类型中 选择 全球唯一识别码
Data1 As Long
Data2 As Long
Data3 As Long
Data4(8) As Byte
End Type
Private Declare Function CoCreateGuid Lib "ole32.dll" ( _
pguid As GUID) As Long
Private Declare Function StringFromGUID2 Lib "ole32.dll" ( _
rguid As Any, _
ByVal lpstrClsId As Long, _
ByVal cbMax As Long) As Long
自定义一个函数
Public Function GetNewGuild() As String
Dim g As GUID
Dim b() As Byte
Dim lSize As Long
Dim lR As Long
CoCreateGuid g
lSize = 40
ReDim b(0 To (lSize * 2) - 1) As Byte
lR = StringFromGUID2(g, VarPtr(b(0)), lSize)
GetNewGuild = Left$(b, lR - 1)
End Function
也可使用access本身字段类型中 选择 全球唯一识别码
(责任编辑:admin)
顶一下
(0)
0%
踩一下
(0)
0%
相关内容
- ·如何将数据表导出备份到excel表格
- ·在表中用组合框选择备选项目
- ·如何设置表的Caption和Description属性
- ·用Access实现学校课程表的科学管理
- ·在表中设置美元等货币符号的方法
- ·Access建表需注意的问题(建表原则)
- ·Access获取表下个自动增加的ID值【两种
- ·Access光标在文本框的右边
- ·Access格式、掩码、文本有效性的异同
- ·access中的掩码
- ·【技巧】Access时间函数汇总(一)
- ·Access隐藏表中的列
- ·Excel与Access简便联系方法
- ·Word文本文件导入到Access2007与导出的
- ·ACCESS字段中设置默认日期值函数大全
- ·ACCESS的真假:三、往一个表中插入10万
最新内容
推荐内容