|
请大虾帮助看一下代码:
Private Sub User_ID_AfterUpdate()
On Err GoTo Err_User_ID_AfterUpdate
'定义字符型变量
Dim STemp As String
If IsNull(Me![User_ID]) Then
UserID = Null
Else
'使用DLoop函数从“系统用户”数据表中搜索登录用户是否存在
STemp = DLookup("User_ID", "System User", "[User_ID]='" & Me![User_ID] & "'")
If IsNull(STemp) Then
UserID = Null
Me![User_ID] = ""
Else
UserID = STemp
Me![User_Name] = DLookup("User_Name", "System User", "[User_ID]='" & Me![User_ID] & "'")
End If
End If
Exit_User_ID_AfterUpdate:
Exit Sub
Err_User_ID_AfterUpdate:
MsgBox "Your input User_ID is error or you haven't registered, Please Check it!", vbCritical, "This User_ID is not existed"
Resume Exit_User_ID_AfterUpdate
End Sub |
|