Trap Error 2501

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Longworth2
    New Member
    • Feb 2008
    • 2

    Trap Error 2501

    Hi there,
    Is there a way to avoid hard-coding the error number 2501 when trapping a no data error? Does Microsoft have a "code" for this error number ?
    Thanks
    Karla
  • Scott Price
    Recognized Expert Top Contributor
    • Jul 2007
    • 1384

    #2
    I'm not sure if I understand what you mean. 2501 IS the code for the 2501 error.

    I assume you are writing a custom error handler routine? Can you paste in the code you are using?

    Regards,
    Scott

    Comment

    • Longworth2
      New Member
      • Feb 2008
      • 2

      #3
      Originally posted by Scott Price
      I'm not sure if I understand what you mean. 2501 IS the code for the 2501 error.

      I assume you are writing a custom error handler routine? Can you paste in the code you are using?

      Regards,
      Scott
      Sorry - I was hoping for something like a variable (i.e. "vbNoData" or some representation) for the error - just in case Microsoft decides to change the value from 2501 to 2502 or 2503 or some other value in the future. I just do not like having "magic numbers" in my code. I've currently set up my own variable but just thought Microsoft has already defined the error codes somewhere.
      Thanks,
      Karla

      Comment

      • Scott Price
        Recognized Expert Top Contributor
        • Jul 2007
        • 1384

        #4
        I see, sorry to tell you that there's no guarantee that MS won't change the 2501 number at some point in the future with another programming language update.

        However, I think that's going to be the least of your worries in the eventuality of such an occurrence.

        Those numbers have been fairly well set (as far as I know) for quite a long time, so there really is no reason to change them. What IS changing with each new language update (i.e. VB6 to VB.NET) is that the method of handling errors gets more sophisticated and powerful. IF Access eventually supports the .NET framework (which A2007 might do, I've been avoiding it like the plague so far, so am not sure) you will need to re-write your error handling code anyway, assuming you upgrade to A2007, so the 'magic number' will be, as I said, the least of your worries.

        Regards,
        Scott

        Comment

        Working...