By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,841 Members | 1,704 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,841 IT Pros & Developers. It's quick & easy.

Runtime error 2001

P: 4
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:

Expand|Select|Wrap|Line Numbers
  1. Private Sub knptoevoegen_Click()
  2. On Error GoTo err_knptoevoegen_click
  3. Dim filid As Variant
  4. Dim beursid As Variant
  5. Dim fout As Integer
  6.  
  7. If IsNull(Me.Klantnummer) Or IsNull(Me.Aantal) Or IsNull(Me.Beurs) Then
  8. MsgBox ("U kunt niet toevoegen. Formulier is niet volledig ingevuld ! "), vbOKOnly
  9. Forms!frmbeurskaart.FilterOn = False
  10.  
  11. Else
  12. Forms!frmbeurskaart.FilterOn = False
  13. DoCmd.GoToRecord , , acNewRec
  14.  
  15.  
  16. End If
  17.  
  18. err_knptoevoegen_click:
  19.  
  20. fout = Err.Number
  21.  
  22. Select Case fout
  23. Case 0
  24. Case 2105
  25. If MsgBox("Deze relatie heeft al beurskaarten besteldt voor deze beurs! Wilt u deze aanpassen ?", vbYesNo) = vbYes Then
  26. filid = Forms!frmbeurskaart!Klantnummer
  27. beursid = Forms!frmbeurskaart!Beurs
  28. Forms!frmbeurskaart.Filter = "Klantnummer =" & filid & "and beurs ='" & beursid & "'"
  29. Me.Undo
  30. Forms!frmbeurskaart.FilterOn = True
  31. Me.Aantal.SetFocus
  32. Else
  33. Me.Undo
  34.  
  35. End If
  36.  
  37.  
  38.  
  39. End Select
  40.  
  41.  
  42. End Sub
The error ocurs by on line 30 --> forms!frmbeurskaarten.filteron = true
Aug 13 '07 #1
Share this Question
Share on Google+
7 Replies


Rabbit
Expert Mod 10K+
P: 12,389
Expand|Select|Wrap|Line Numbers
  1. Forms!frmbeurskaart.Filter = "Klantnummer =" & filid & "and beurs ='" & beursid & "'"
This needs to have a space in the between the filid and the "and"

Expand|Select|Wrap|Line Numbers
  1. Forms!frmbeurskaart.Filter = "Klantnummer =" & filid & " and beurs ='" & beursid & "'"
Aug 13 '07 #2

P: 4
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...
Aug 13 '07 #3

Rabbit
Expert Mod 10K+
P: 12,389
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.
Aug 13 '07 #4

P: 4
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.
Aug 14 '07 #5

Rabbit
Expert Mod 10K+
P: 12,389
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?
Aug 14 '07 #6

P: 4
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.
Aug 15 '07 #7

Rabbit
Expert Mod 10K+
P: 12,389
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.
Aug 15 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.