我很高兴在MS Access 2007中创建Access数据库,最近我创建了一个简单的登录和启动画面窗体。现在,每次我尝试在我的文本框中输入一个字符串时,程序都会崩溃。
错误消息说:Microsoft Access已停止工作。 Windows可以尝试恢复您的数据。
采取的补救行动:
下面是我在开头插入的简单VB代码:
Option Compare Database
Public intlogonattempts As Integer
Private Sub cmdOK_Click()
'Check to see if data is entered into the password box
If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.txtPassword.SetFocus
Exit Sub
End If
'Check value of password in tblEmployees to see if this
'matches value chosen in combo box
If Me.txtPassword.Value = "password" Then
DoCmd.Close acForm, "frmLogon", acSaveNo
DoCmd.OpenForm "frmSplash_Screen"
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, _
"Invalid Entry!"
Me.txtPassword.SetFocus
End If
'If User Enters incorrect password 3 times database will shutdown
intlogonattempts = intlogonattempts + 1
If intlogonattempts > 3 Then
MsgBox "You do not have access to this database.Please contact admin.", _
vbCritical, "Restricted Access!"
Application.Quit
End If
End Sub
这里有什么潜在影响/破坏程序吗?
感谢