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:
- I tried the 'Compact & Repair Database' option. (no good)
- I tried to delete the logon and splash screens (crashes)
- 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