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.