If IsNull(Me.Text1) Then
GuserID = Me.Text1
Call insertLogo("用户登陆")
Me.Visible = False
以上的代码应该放在下面代码中的那个位置?
Private Sub Command16_Click()
'定义 connection 对象
Dim cn As ADODB.Connection
'定义 recordset 对象
Dim rs As New ADODB.Recordset
Dim sql As String
'使用access内置 connection对象
Set cn = CurrentProject.Connection
If IsNull(Me.Text1) Or IsNull(Me.Text3) Then
MsgBox "请输入用户和密码"
Exit Sub
End If
sql = "select*from 员工表 where 员工姓名 ='" & Me.Text1 & " ' and 密码 = '" & Me.Text3 & "'"
Debug.Print sql
rs.Open sql, cn
If rs.EOF Then
MsgBox "密码或用户名错误!请重新输入!"
Text1.SetFocus
Text1.Text = ""
Text3.SetFocus
Text3.Text = ""
Else
DoCmd.Close
DoCmd.OpenForm "操作日记窗体"
MsgBox "只要努力一切皆有可!"
End If
'关闭 recodset 对象和connection对象并释放内存资源
rs.Close
cn.Close
Set rs = Nothing
End Sub