Runtime error 2001

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • David01
    New Member
    • Aug 2007
    • 4

    Runtime error 2001

    When I run some code behind a button i get a runtime error message. The strange thing is that the code run perfectly some months ago. Can some one help me !
    Some additional information: The company I work for upgraded the citrix enviremont.

    Here is the code:

    Code:
    Private Sub knptoevoegen_Click()
    On Error GoTo err_knptoevoegen_click
    Dim filid As Variant
    Dim beursid As Variant
    Dim fout As Integer
    
    If IsNull(Me.Klantnummer) Or IsNull(Me.Aantal) Or IsNull(Me.Beurs) Then
    MsgBox ("U kunt niet toevoegen. Formulier is niet volledig ingevuld ! "), vbOKOnly
    Forms!frmbeurskaart.FilterOn = False
    
    Else
    Forms!frmbeurskaart.FilterOn = False
    DoCmd.GoToRecord , , acNewRec
    
    
    End If
    
    err_knptoevoegen_click:
    
    fout = Err.Number
    
    Select Case fout
    Case 0
    Case 2105
    If MsgBox("Deze relatie heeft al beurskaarten besteldt voor deze beurs! Wilt u deze aanpassen ?", vbYesNo) = vbYes Then
    filid = Forms!frmbeurskaart!Klantnummer
    beursid = Forms!frmbeurskaart!Beurs
    Forms!frmbeurskaart.Filter = "Klantnummer =" & filid & "and beurs ='" & beursid & "'"
    Me.Undo
    Forms!frmbeurskaart.FilterOn = True
    Me.Aantal.SetFocus
    Else
    Me.Undo
    
    End If
    
    
    
    End Select
    
    
    End Sub
    The error ocurs by on line 30 --> forms!frmbeursk aarten.filteron = true
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Code:
    Forms!frmbeurskaart.Filter = "Klantnummer =" & filid & "and beurs ='" & beursid & "'"
    This needs to have a space in the between the filid and the "and"

    Code:
    Forms!frmbeurskaart.Filter = "Klantnummer =" & filid & " and beurs ='" & beursid & "'"

    Comment

    • David01
      New Member
      • Aug 2007
      • 4

      #3
      Thank you for your reaction.

      I tried it but I still keep the same message.

      Any other suggestions?

      The same code works at home fine ? I jus don't get it...

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Originally posted by David01
        Thank you for your reaction.

        I tried it but I still keep the same message.

        Any other suggestions?

        The same code works at home fine ? I jus don't get it...
        It works fine at home?

        Is it an exact duplicate?
        Check your Visual Basic references under Tools > References in the Visual Basic Editor. See if you're missing any.
        Try out your filter in a query and see if that's built correctly.

        Comment

        • David01
          New Member
          • Aug 2007
          • 4

          #5
          Hey,

          The strange thing is, when I use the original file it works fine, even on my company workspace. But when I import it into the main database I get the same error message.

          I'm running out of clues.

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            Originally posted by David01
            Hey,

            The strange thing is, when I use the original file it works fine, even on my company workspace. But when I import it into the main database I get the same error message.

            I'm running out of clues.
            Import what into your main database?
            What do you mean by original file? If your main database isn't your original then what is it?

            Comment

            • David01
              New Member
              • Aug 2007
              • 4

              #7
              At my workspace I have a database running (backend and frontend). Sometimes I develop new items at home. Then I e-mail that to my worspace and import the table's, forms en query's into that database.So the e-mailed version works fine but when imported it doesn't. The strange thing is that it worked fine before. So I imported it again but that doesn't help.

              Comment

              • Rabbit
                Recognized Expert MVP
                • Jan 2007
                • 12517

                #8
                Well, since you seperated the data tables from the front end, can't you just replace your current front end with the one from home?

                I think the problem may be you changed the name of some control for some reason and it can no longer find it.

                You can also try compacting and repairing and/or compiling the code. Compiling should bring up some syntax errors.

                Comment

                Working...