Dim UserName As String
Dim UserGroup As String
Dim PassWord As String
Dim dr As DataRow
If Forms("用户管理").Opened Then '正常打开
UserName = Forms("用户管理").Controls("ListBox1").SelectedItem
Else
UserName = _UserName '_UserName为全局变量,用于保存当前用户名
e.Form.Controls("UserName").Enabled = False
e.Form.Controls("UserGroup").Enabled = False
e.Form.Controls("备注").Enabled = False
e.Form.Controls("企业名").Enabled = False
e.Form.Controls("编号地址").Enabled = False
e.Form.Controls("地址").Enabled = False
e.Form.Controls("电话").Enabled = False
e.Form.Controls("指定打印机名称").Enabled = False
e.Form.Controls("公司合同社保").Enabled = False
e.Form.Controls("公司名称").Enabled = False
e.Form.Controls("公司地址").Enabled = False
e.Form.Controls("公司法定代表人").Enabled = False
End If
e.Form.Text = e.Form.Text & "-" & UserName
dr = _UserTable.SQLFind("[Name] = '" & UserName & "'")
If dr IsNot Nothing Then
e.Form.Controls("UserName").Value = UserName
e.Form.Controls("UserGroup").Value = dr("Group")
e.Form.Controls("PassWord").Value = dr("PassWord")
e.Form.Controls("备注").Value = dr("账号备注")
e.Form.Controls("企业名").Value = dr("账号企业名")
e.Form.Controls("编号地址").Value = dr("账号编号地址")
e.Form.Controls("地址").Value = dr("账号地址")
e.Form.Controls("电话").Value = dr("账号电话")
e.Form.Controls("指定打印机名称").Value = dr("指定打印机名称")
e.Form.Controls("公司合同社保").Value = dr("公司合同社保")
e.Form.Controls("公司名称").Value = dr("公司名称")
e.Form.Controls("公司地址").Value = dr("公司地址")
e.Form.Controls("公司法定代表人").Value = dr("公司法定代表人")
Else
MessageBox.Show("用户不存在或者已经被删除!","提示",MessageBoxButtons.OK)
e.Form.Close()
End If
这样显示的