I have a access DB that is now giving an error after I upgraded to Access 2007.
This is the full code. The error is highlighted.
Option Compare Database
Option Explicit
Private Sub cmdCancel_Click()
DoCmd.Quit
End Sub
Private Sub cmdOK_Click()
'20001010 JBT
Dim RS As Recordset
Dim SQL As String
If Me.txtPassword.Value = "" Then
MsgBox "PLEASE ENTER A VALID PASSWORD."
Me.txtPassword.Value = ""
Me.txtPassword.SetFocus
Exit Sub
Else
If Len(Me.txtPassword.Value) <> 7 Then
MsgBox "Passwords are 7 characters in length.", vbOKOnly
Me.txtPassword.Value = ""
Me.txtPassword.SetFocus
Exit Sub
End If
End If
SQL = "SELECT * FROM tblGECardHolders " & _
"WHERE (((tblGECardHolders.Last7No)= '" & Me.txtPassword.Value & "') AND " & _
"((tblGECardHolders.Inact)=No));"
Set RS = CurrentDb.OpenRecordset(SQL, dbOpenSnapshot)
If RS.RecordCount = 0 Then
MsgBox "INVALID PASSWORD, PLEASE TRY AGAIN.", vbOKOnly
CurrentDb.Close
Me.txtPassword.Value = ""
Me.txtPassword.SetFocus
Exit Sub
Else
strPassword = RS.Fields(0)
RS.Close
DoCmd.OpenForm "frmGEMainMenu", acNormal, , , acFormAdd, acWindowNormal
DoCmd.Close acForm, "frmBackground", acSaveNo
DoCmd.Close acForm, "frmGELogon", acSaveNo
End If
CurrentDb.Close
End Sub