Office中国论坛/Access中国论坛

标题: 请帮我看看这段代码错在哪里? [打印本页]

作者: yxiang    时间: 2005-8-20 18:38
标题: 请帮我看看这段代码错在哪里?


Private Sub cmdyes_Click()

    Dim Temp As String

If IsNull(Me![User_Name]) Or IsNull(Me![User_Password]) Then

    MsgBox "您输入的用户名和密码不能为空,请重新输入!", vbOKOnly, "警告信息"

Else

   Dim Rs As ADODB.Recordset

   Set Rs = New ADODB.Recordset

   Temp = "Select * From 用户 Where 注册名称= '" & Me![User_Name] & " 'And 注册密码='" & Me![User_Password] & "'"

   Rs.Open Temp, CurrentProject.Connection, adOpenKeyset, adLockOptimistic(调试时提示这里有错,怎么改呢?)

   If Rs.RecordCount > 0 Then

   DoCmd.Close

   DoCmd.OpenForm "切换面板", acNormal, "", "", acFormReadOnly, acWindowNormal

Else

   MsgBox "您输入的用户名和密码有误,请重新输入!", vbOKOnly, "警告信息"

End If

   Rs.Close

   Set Rs = Nonthing

End If

End Sub

[此贴子已经被作者于2005-8-22 12:50:06编辑过]






欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3