Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Error handler (97)

    Error handler

    Set qd = db.CreateQueryDef("qryDtlMgrMth" & i, "SELECT tblPromotionType.promotionType, Manager.Code, Manager.DirectorCode, tblYear.Year, tblMonth.Month, tblMonth.MonthName, Manager.ManagerName FROM Manager, tblMonth, tblPromotionType, tblYear GROUP BY tblPromotionType.promotionType, Manager.Code, Manager.DirectorCode, tblYear.Year, tblMonth.Month, tblMonth.MonthName, Manager.ManagerName ORDER BY tblPromotionType.promotionType, Manager.Code, Manager.DirectorCode, tblMonth.Month;")

    errorHandler:
    Select Case err.number
    'qry exists already...
    Case 3012
    Exit Sub
    End Select

    The above SET statement creates error 3012 when i try to create my query definition. As such I created the ERROR HANDLER statement just above as well. Problem is when the error occurs, nothing happens, the ERROR HANDLER does not receive control of the flow at this point, why is this? Please note that the SET statement does appear within a SELECT CASE statement nested within a FOR loop which itself occurs within another SELECT CASE statement.

  2. #2
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Edmonton, Alberta, Canada
    Posts
    326
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Error handler (97)

    When you say nothing happens, are you saying you don't get a message, or what? As it stands, your program will exit the subroutine without any messages whenever there is an error (any error). How do you know it's not getting to your error handler?

    If you want to see messages for other errors when you have an error handler, you need to explicitly output them with, e.g.
    msgbox err.number & " " & err.description
    (I like showing the number - makes it easier to look up weird errors).

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Error handler (97)

    Did you remember to put "On Error Goto ErrorHandler" in your routine?
    Charlotte

  4. #4
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Error handler (97)

    Thanks, my On Error GoTo errorHandler wasn

Posting Permissions

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