设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 3852|回复: 10
打印 上一主题 下一主题

[Access本身] 操作日志的用户名怎样才能是登入用户名?

[复制链接]
1#
发表于 2012-8-27 10:08:41 | 显示全部楼层
SysLog模块下的代码中CurrentUser改为全局变量SuerName
Public Sub WriteLog(Ope As String, Cap As String)
    DoCmd.SetWarnings False
    DoCmd.RunSQL "insert into Log ( UserName,PC,Operation ) select '" & SUserName & "',fOSMachineName(),'" & Ope & Cap & "';"
    DoCmd.SetWarnings True
End Sub
2#
发表于 2012-8-27 15:26:41 | 显示全部楼层
你在call WriteLog的代码上一行,先调试下SUserName有没有返回值
3#
发表于 2012-8-27 16:19:52 | 显示全部楼层

Public Sub WriteLog(Ope As String, Cap As String)
    UserName = DLookup("用户名", "用户表", "用户id=" & UserID)
    DoCmd.SetWarnings False
    DoCmd.RunSQL "insert into Log ( UserName,PC,Operation ) select '" & UserName & "',fOSMachineName(),'" & Ope & Cap & "';"
    DoCmd.SetWarnings True
End Sub
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-5-5 07:33 , Processed in 0.083346 second(s), 26 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表