We help IT Professionals succeed at work.
Get Started

Run-Time Error '3709'

Todd West
Todd West asked
on
172 Views
Last Modified: 2020-02-04
I have an access database that will be used for issue tracking within my organization.  I had added a crude security (Log-in) feature consisting of choosing a Program Office from a combo box and an Access-Key entered into a text box; it was not the most elegant code but was working fine.  Then I made some edits/changes to other features of the database, nothing that should have effected the code I have for logging in but started receiving a Run-Time Error 3709, The search key was not found in any record.  The change I made was to a long text field in one of my tables changing it to track comment history by making it an append only field.  I then went back to earlier draft versions of the database to double check that I had not accidentally changed something in the code only to find all previous versions were experiencing the same error.  

It is really important that I keep a running history of comments added to a record but it is also important that I limit program office access to only those issues that apply to them; I am using the log-in features to set a temp variable used later to filter records.  My code is below but I am not certain the problem is in the code.  

First I test for Null values; then I test for User credentials, this is where I am getting the error; finally I test for admin credentials which work perfectly.  I am a novice at best and have ran out of ideas.  Any assistance you can provide is greatly appreciated.

Private Sub cmdLogin_Click()
Dim varPOFilter As String
Dim tvarAdmin As String

If IsNull(Me.cboPgmUser) Then  
    MsgBox "You must select a Program Office from the dropdown list provided.", vbInformation, "Program Office Required"  
    Me.cboPgmUser.SetFocus  
   
ElseIf IsNull(Me.txtAccessKey) Then  
    MsgBox "You must enter the Access Key for the Program Office selected.", vbInformation, "Access Key Required"  
    Me.txtAccessKey.SetFocus  
   
' Test for Permissions
    Else
        If Me.cboPgmUser.Column(5) = "User" And Me.txtAccessKey = Me.cboPgmUser.Column(4) = True Then
                TempVars.Add "varPOFilter", cboPgmUser.Column(4)
                DoCmd.Close acForm, "LOGIN", acSaveNo
                DoCmd.OpenForm ("Switchboard User")      'THIS IS WHERE THE DEBUGGER HIGHLIGHTS FOR THE ERROR
               
        ElseIf Me.cboPgmUser.Column(5) = "Admin" And Me.txtAccessKey = Me.cboPgmUser.Column(4) = True Then
                  TempVars.Add "tvarAdmin", "Grant"
                  DoCmd.Close acForm, "LOGIN", acSaveNo
                  DoCmd.OpenForm ("Switchboard Admin")
           
              Else
                MsgBox "The Program Office and Access Key are not a match, please try again.", vbInformation, "Log In Failure"
                Me.txtAccessKey = ""
                Exit Sub
                  End If
         End If
Comment
Watch Question
CERTIFIED EXPERT
Distinguished Expert 2017
Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant

An Experts Exchange subscription includes unlimited access to online courses.

Get Started
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE