Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2002
    Location
    Norway
    Posts
    239

    Question Unanswered: Determine Event type

    Hi.
    For error reporting purpose I would like to determine the Event type where the error occurred. Like "After update", "On Click", "On Open"
    Can anyone help ?

    Thanks

  2. #2
    Join Date
    Feb 2004
    Posts
    199
    ?!
    if you have code on that event , so what's the problem, just put in the error message Title the event's name,
    if an error ocurs that isn't related with that events and you need to figure out when that error ocured, you should just put debug.print eventname in ceach event and see vba output window
    MDB, ADP <-> MS SQL + VBA, ADO & RDO, .NET, Oracle, Java/Jsp.

  3. #3
    Join Date
    Nov 2002
    Location
    Norway
    Posts
    239

    Post

    Hi.
    As you misunderstand, I might not express myself clear enough.
    The situation is that in all event procedures I start with:
    On Error goto Common_Error

    In the Common_Error section I call a procedure identifying, among other the form name and the control name. The user will then get the option of mailing this error to the programmer. (me)
    Now you understand that the information about what kind of event used should be sent to the error procedure as a parameter.
    (It's no solution to put in this information manually)

    Thanks.

  4. #4
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    It is better to write for every event an Error rotine, isuing a message where it had been called.
    Example

    Function CSQLDate(varDate As Variant) As String
    &nbsp;'This funktion changes any given date format to a string that used in the SQL-Statment,

    &nbsp;&nbsp;On Error GoTo CSQLDate_Error

    &nbsp; If IsDate(varDate) Then
    CSQLDate = "#" & Month(varDate) & "/" & Day(varDate) & "/" & &nbsp;Year(varDate) & "#"
    &nbsp;&nbsp; Else
    &nbsp;&nbsp; CSQLDate = ""
    &nbsp; End If

    CSQLDate_Exit:
    &nbsp; Exit Function

    CSQLDate_Error:
    &nbsp;&nbsp; 'MsgBox "Fehler bei Datumskonvertierung: " & Error$, vbOKOnly + vbInformation, "CSQLDate"
    MsgBox "Error " & Err.number & " in an Date conversion function: " & vbNewLine & " " & Err.number & " " & Err.Description & vbNewLine

    & "Called from: " & vbNewLine & vbNewLine & _
    "CSQLDate ([" & varDate & "])", vbOKOnly + vbInformation, "CSQLDate (.)"


    &nbsp; Resume CSQLDate_Exit
    End Function


    As you see here in the part Called from will be added manualley for every event Function or Sub.

  5. #5
    Join Date
    Nov 2002
    Location
    Norway
    Posts
    239

    Thumbs down

    HI

    Sorry hammbakka, I can't see anywhere in your code a instruction indicating from what event type the error occur in. It's no option to include a separate routine in every event procedure. (until now it has been implemented in 686 different event procedures)
    As an option, does anyone knows how to indicate line number in the code ?

    like: Msgbox "This is line: " & Me.????


    thanks a lot
    Vestigo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •