473,497 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Error code 2501 haunting me

28 New Member
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
4 1912
missinglinq
3,532 Recognized Expert Specialist
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
32,556 Recognized Expert Moderator MVP
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
mhifd009
28 New Member
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
32,556 Recognized Expert Moderator MVP
I'm sorry I can't be more help :(.
Good luck though.
Dec 19 '06 #5

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

Similar topics

2
8442
by: ColinWard | last post by:
My previous message was blank so Im trying again. I have a button on a form which opens the Import dialogue box. This works fine except if I click on the "X" to close the form I get Run-Time Error...
1
5561
by: Bob Dydd | last post by:
Hi everyone It's me again. I have an access 2000 database with 12 landscape reports which sometimes have to be FAXED and other times printed, so I have written the following code and put it...
5
28910
by: fearblanco | last post by:
Hello - I am receiving the below error message when attempting to open a report. This database is used by approximately 20 users and only one user is having this problem (even I can't duplicate...
3
6113
by: Ed Robichaud | last post by:
I'm temporarily stumped on how to handle/suppress an error (2501) if a user cancels sending an email. I'm using DoCmd.SendObject to trigger an Outlook send window, which works OK, but if the msg...
4
9420
by: Keith | last post by:
I have the following code in the On No Data event of a report: **** On Error GoTo err_trap MsgBox "No items matching criteria.", vbInformation, gcApplication Cancel = True err_trap: If...
33
3104
by: Anthony England | last post by:
I am considering general error handling routines and have written a sample function to look up an ID in a table. The function returns True if it can find the ID and create a recordset based on...
7
2945
by: Keith Wilby | last post by:
In an old A97 app I trap for error 2501 in a report's calling code just in case there are no records to return (set cancel = True in the report's No Data event). This doesn't seem to work in my...
8
2439
by: sara | last post by:
I have a report that runs fine with data. If there is no data, I have its NO Data event sending a MsgBox and cancelling the report. Then it seems I still get the 2501 message on the Open Report...
3
3594
by: fperri | last post by:
Hello, I have a form in Access for users to do updates from. I'm trying to catch the error 2501 that pops up if they say cancel to the prompt that tells them how many records they are going to...
0
7120
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6991
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7160
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7196
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6878
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
3088
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1405
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
286
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.