Results 1 to 9 of 9
  1. #1
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664

    Error messages

    What does



    1. On error <> resume next

    and

    2. If Err.Number <. 0 then



    I know that the first is an error message a catch it points out an error. However, when I put my cursor on it, I get no indication of such.


    Also, when I put my the mouse cursor on the second I get nothing. It seems to have a mind of its own. I am just unsure what is going on.

    Any help appreciated. Thanks in advance.

    Respectfully,


    Lou Reed

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I've not seen either example before. I have seen:
    On error resume next

    and

    If Err.Number <> 0 then

  3. #3
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    You are correct the statement should read :

    On error resume next

    The second I believe is correct. I need to know about the interpretation.

    Respectfully,


    Lou Reed

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Well <.0 is the same as <0 and there are quite a few Reserved Error Numbers that are probably negative numbers. The code appears to be trying to catch them. I don't know what the errors mean and you usually have to Google the error number and see if there is an answer.

  5. #5
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    You are correct again, the statement should read:

    If Err.Number <> 0 then

    I think that I know what the first means it is the second one (repeated above) that I find confusing.


    Respectfully,


    Lou Reed

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    As you probably know when Err.Number = 0 there were no errors detected.

  7. #7
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Of course. But when the statement

    If Err.Number <> 0 then

    is reached it executes the interior decision art of the if-then endif statement as "if Err.Number <> 0" is true. Now I am pretty sure that there are no errors yet this execution of the program implies that Err.number has a value other than 0.

    When I put the cursor on the Err.number it shows nothing. So what is the Err.number? How do I find out what error has occurred and how do I take action to fix.

    Actually, the first part is the only part that is important now. How do I find out the error?

    Any help appreciated. Thanks in advance.

    Respectfully,

    Lou Reed

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    MsgBox "[" & Err.Number & "]"

  9. #9
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    If Err.Number <> 0 then
    is reached it executes the interior decision art of the if-then endif statement as "if Err.Number <> 0" is true.
    Of course it does. If no error hasn't been raised, it will execute because the error number is zero. That's what "If Error number <> 0" means. If it is anything other than 0, an error occurred, so don't process the If block is what the code is saying. You can't always get a hint by mousing over things. Variables most of the time, yes. But this is a property of the Error object and as such, these things don't always respond that way. You can usually go further with this by using the Immediate window, where you "ask" Access about something by prefacing it with a question mark. So to check if an error has been raised, there you would type ?Err.Number and hit return.

    Now I am pretty sure that there are no errors yet this execution of the program implies that Err.number has a value other than 0.
    No it doesn't. Rather than repeat myself to address that part of your statement, just re-read my explanation if necessary. You could post the relevant code if you want some explanation in English terms rather than just how vba expresses itself.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 05-04-2016, 05:32 AM
  2. Turn Off Error Messages for Printing
    By pdevito3 in forum Access
    Replies: 3
    Last Post: 09-24-2013, 02:15 PM
  3. How to handle error messages?
    By yes sir in forum Access
    Replies: 3
    Last Post: 10-15-2011, 11:22 AM
  4. Custom messages to Access' default error messages.
    By evander in forum Programming
    Replies: 1
    Last Post: 06-26-2010, 02:06 AM
  5. Error Messages
    By DataGeek in forum Access
    Replies: 0
    Last Post: 12-06-2007, 09:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums