为什么我的Access数据库会崩溃?

时间:2014-11-17 13:10:01

标签: vba ms-access

我很高兴在MS Access 2007中创建Access数据库,最近我创建了一个简单的登录和启动画面窗体。现在,每次我尝试在我的文本框中输入一个字符串时,程序都会崩溃。

错误消息说:Microsoft Access已停止工作。 Windows可以尝试恢复您的数据。

采取的补救行动:

  1. 我试过' Compact& amp;修复数据库'选项。 (不好)
  2. 我尝试删除登录和启动画面(崩溃)
  3. 我使用Alt + F11访问VB代码(再次崩溃)
  4. 下面是我在开头插入的简单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
    

    这里有什么潜在影响/破坏程序吗?

    感谢

0 个答案:

没有答案