Calling Error Handling in VBA

Discussion in 'Access Forms Coding' started by pcm1977, Mar 26, 2013.

  1. pcm1977

    pcm1977 Guest

    I found code that Allen Browne created to capture errors into a table.

    The issue I have is how to call it? What do i put in my code at line "3" below to call this Public Function?

    From Allen Browne's Web Site

    1 Sub|Function SomeName()
    2 On Error GoTo Err_SomeName ' Initialize error handling.

    3 ' Code to do something here. ' THIS WHAT I CANNOT FIGURE OUT

    4 Exit_SomeName: ' Label to resume after error.
    5 Exit Sub|Function ' Exit before error handler.
    6 Err_SomeName: ' Label to jump to on error.
    7 MsgBox Err.Number & Err.Description ' Place error handling here.
    8 Resume Exit_SomeName ' Pick up again and quit.
    9 End Sub|Function

    I have tried:

    "Call LogError" = Error Message "Compile Error: Argument not optional"
    "LogError" = Error Message "Compile Error: Argument not optional"
    "LogError()" = "Compile Error: Expected ="
    pcm1977, Mar 26, 2013
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.