1

I was happily creating an Access Database in MS Access 2007 and I recently created a simple logon and splash screen form. Now, everytime i try to enter a string into my textbox, the program keeps crashing.

Error message says: Microsoft Access has stopped working. Windows can try and recover your data.

Remedial Actions Taken:

  1. I tried the 'Compact & Repair Database' option. (no good)
  2. I tried to delete the logon and splash screens (crashes)
  3. I trield Alt+F11 to access the VB code (crashes again)

Below is the simple VB code i inserted at the start:

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

Is there anything underlying here that is affecting/corrupting the program?

thanks

Johnny Bones
  • 8,786
  • 7
  • 52
  • 117
Tiny
  • 409
  • 2
  • 8
  • 20
  • 1
    this sounds like an access-vba question not VB.NET – Ňɏssa Pøngjǣrdenlarp Nov 17 '14 at 13:20
  • @Plutonix definitively DoCmd is Access VBA – Steve Nov 17 '14 at 13:32
  • 3
    You could try to [decompile/recompile](http://stackoverflow.com/questions/3266542/how-does-one-decompile-and-recompile-a-database-application) – Mark C. Nov 17 '14 at 13:36
  • I don't know your level of expertise, but I see absolutely no error trapping going on in this code. This is a horrible strategy and leads to you wondering why you're receiving errors and wondering what they mean. Proper error trapping should help you narrow this down. – Johnny Bones Nov 17 '14 at 13:51
  • have you got any events being triggered from the textbox? sounds like you're hitting an infinite loop. You could try pressing Ctrl + Break to force break the code and see where it is crashing. – SierraOscar Nov 17 '14 at 14:57
  • Access has always been plagued by issues like this, and they almost always involve references. The first thing I would do is to create a new DB, and import all of my objects from the DB that is having issues. Then, hit Ctrl-G, and look at the Tools > References collection. Try to minimize the references being used. Often during development, Access tried to help by referencing libraries you may not need. One small note, I would exit the SUB in your code where you open the Splash screen as there is no need for the code to continue. – DanielG Nov 17 '14 at 15:31
  • Thanks! The decompile solved the problem. Many thanks. – Tiny Dec 13 '14 at 14:33

0 Answers0