【发布时间】:2017-04-20 03:31:00
【问题描述】:
'Check to see if the recordset actually contains rows
If Not (recordSet.EOF And recordSet.BOF) Then
recordSet.MoveFirst 'Unnecessary in this case, but still a good habit
'See if credentials match data
Do
If (recordSet!User_ID = PERSAL And recordSet!Password = Password) Then
'Open Menu form
DoCmd.OpenForm "Menu", acNormal, "", "", , acNormal
recordSet.Close 'Close the recordset
Set recordSet = Nothing 'Clean up
'Close Login form
DoCmd.Close acForm, "Login"
Exit Do
End If
recordSet.MoveNext
If (recordSet.EOF Or recordSet.BOF) Then
MsgBox "Your credentials are incorrect or you are not registered."
Exit Do
End If
Loop
'Match the values entered for PERSAL nr. and password fields with a row in User table
Else
MsgBox "There are no records in the recordset."
recordSet.Close 'Close the recordset
Set recordSet = Nothing 'Clean up
End If
Form_Login.txtUser_ID.SetFocus
我已经尝试了过去 2 天找到的所有解决方案,但都无法解决我的错误 2501:
我做到了:
- 反编译
- 压缩和修复
- 处理 MSCOMCTL.OCX 文件
- 导入新的访问文件
我已经花光了。
对于 MSCOMCTL.OCX 文件,我正在考虑下载 2007 Office 更新 SP 3。
异常/错误出现在这一行:
DoCmd.OpenForm "Menu", acNormal, "", "", , acNormal
【问题讨论】:
-
检查您的表单打开/加载事件。此外,遍历员工表以查找员工并不是最佳做法。使用 sql 或 dlookups