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

Error code 2501 haunting me

P: 28
I have simple error catch in my code :

Private Sub ordsch_Click()
On Error GoTo errhandler
DoCmd.OpenForm "Order Search"

errhandler:
Exit Sub
End Sub

The Order search opens a query that has a parameter request for the user to enter a search string, so it allows ok and cancel, if the user enters info - all ok, but if the user clicks cancel then i get error 2501.

The problem i have is that the error trap worked yesterday and i have not touched this area of code at all today (the coding gremlin has been at large again). I have compiled ok, compressed and repaired.

Any ideas ?
Dec 10 '06 #1
Share this Question
Share on Google+
4 Replies


missinglinq
Expert 2.5K+
P: 3,532
Using your code, I can't replicate your problem. That, together with your statement that it worked the day before and you haven't messed with the code, makes me think that the db has become corrupted. I'd open a new blank db and import everything into it and see what happens.
Dec 10 '06 #2

NeoPa
Expert Mod 15k+
P: 31,616
I get a special MS Office problem in Access sometimes when I compile my code.
It complains about a particular definition line not existing - but it's lying.
If I Cut the line; recompile; don't worry about error message; Paste the line back in where it was before; Move the cursor from the line; Recompile; then it works again.
If the compiler doesn't throw an error, maybe you could Cut the whole module; recompile; Paste in the module again; Recompile; Test.
Dec 10 '06 #3

P: 28
Sorry its took so long to reply - had to leave the project for a while, i have tried the suggested, and no different, I can go into my project (DB) and the eror doesnt appear, within minutes it can re-appear with no change to coding, maybe i have a corrupt access install - cuz if i put onto the pc where the intended program will sit then i have not seen the problem occur - thanks again for your suggestions.
Dec 18 '06 #4

NeoPa
Expert Mod 15k+
P: 31,616
I'm sorry I can't be more help :(.
Good luck though.
Dec 19 '06 #5

Post your reply

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