Public Function funIdTypeStone(IdStone As Long) As Long On Error GoTo Err_function Dim Criteria As String Dim varValue As Variant Criteria = "IdStone=" & IdStone varValue = DLookup("IdTypeStone", "tblStone", Criteria) If IsNull(varValue) Then MsgBox "Не определен тип камня", vbExclamation, "Определение типа камня" funIdTypeStone = 0 Else funIdTypeStone = varValue End If Exit_function: Exit Function Err_function: MsgBox Err.Description, vbExclamation, "Определение типа камня" Resume Exit_function End Function