ACCESS中如何记录当前windows账号
时间:2011-03-22
来源:互联网
access 新增一条记录能自动记录当前windows账号(AD 用户)。例如:产品表如下:
产品编号 产品名称 录入人员 录入日前
在窗体每增加一条记录到表中,录入日期自动获取当前系统日期,录入人员 也增自动获取当天登录电脑的域账号,这个应该怎么实现呢?
产品编号 产品名称 录入人员 录入日前
在窗体每增加一条记录到表中,录入日期自动获取当前系统日期,录入人员 也增自动获取当天登录电脑的域账号,这个应该怎么实现呢?
作者: Irma 发布时间: 2011-03-22
参考access帮助里面的GetLogonName函数
本主题包含用户定义的函数 GetLogonName,该函数用于返回当前用户名。GetLogonName 函数利用 GetUserNameA Windows API 来检索当前用户名。
' Access the GetUserNameA function in advapi32.dll and
' call the function GetUserName.
Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long
' Main routine to retrieve user name.
Function GetLogonName() As String
' Dimension variables
Dim lpBuff As String * 255
Dim ret As Long
' Get the user name minus any trailing spaces found in the name.
ret = GetUserName(lpBuff, 255)
If ret > 0 Then
GetLogonName = Left(lpBuff, InStr(lpBuff, Chr(0)) - 1)
Else
GetLogonName = vbNullString
End If
End Function
本主题包含用户定义的函数 GetLogonName,该函数用于返回当前用户名。GetLogonName 函数利用 GetUserNameA Windows API 来检索当前用户名。
' Access the GetUserNameA function in advapi32.dll and
' call the function GetUserName.
Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long
' Main routine to retrieve user name.
Function GetLogonName() As String
' Dimension variables
Dim lpBuff As String * 255
Dim ret As Long
' Get the user name minus any trailing spaces found in the name.
ret = GetUserName(lpBuff, 255)
If ret > 0 Then
GetLogonName = Left(lpBuff, InStr(lpBuff, Chr(0)) - 1)
Else
GetLogonName = vbNullString
End If
End Function
作者: Gemmy 发布时间: 2011-03-22

作者: Irma 发布时间: 2011-03-22
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28