S
SCrowley
Hello,
OL2003
In creating a custom Required Category Form (using Sue Mosher's original
code, modified) I am tyring to create an Error_Handler to fire a Message Box
if the user doesn't select 3 of the required categories. I'm not sure if I
should use the Exit Function or Resume statement or if I'm placing it in the
right line of the code.
Here is the partial code:
Function HasRequiredCategory()
'Set Error Trap
On Error GoTo Error_Handler
Dim intMatchCount
Dim intReqCats
'******USER OPTION*****
'number of category matches required
intReqCats = 3
Set objPage = Item.GetInspector.ModifiedFormPages("General")
Set objControl = objPage.Controls("lstCategories")
If gstrRequiredCats <> "" Then
arrCats = Split(UCase(Item.Categories),",")
arrRequiredCats = Split(gstrRequiredCats,";")
For I = 0 To UBound(arrCats, 1)
For J = 0 To UBound(arrRequiredCats, 1)
If Trim(arrCats(I)) = Trim(arrRequiredCats(J)) Then
intMatchCount = intMatchCount + 2
If intMatchCount >= intReqCats Then
Exit For
End If
End If
Next
If intMatchCount >= intReqCats Then
Exit For
End If
Next
End If
HasRequiredCategory = (intMatchCount >= intReqCats)
Exit Function
'Error Handling Routine
Error_Handler:
'Handle the error
MsgBox "Please select categories as instructed in the Red Box located to the
left of the Categories box"
Exit Function
End Function
OL2003
In creating a custom Required Category Form (using Sue Mosher's original
code, modified) I am tyring to create an Error_Handler to fire a Message Box
if the user doesn't select 3 of the required categories. I'm not sure if I
should use the Exit Function or Resume statement or if I'm placing it in the
right line of the code.
Here is the partial code:
Function HasRequiredCategory()
'Set Error Trap
On Error GoTo Error_Handler
Dim intMatchCount
Dim intReqCats
'******USER OPTION*****
'number of category matches required
intReqCats = 3
Set objPage = Item.GetInspector.ModifiedFormPages("General")
Set objControl = objPage.Controls("lstCategories")
If gstrRequiredCats <> "" Then
arrCats = Split(UCase(Item.Categories),",")
arrRequiredCats = Split(gstrRequiredCats,";")
For I = 0 To UBound(arrCats, 1)
For J = 0 To UBound(arrRequiredCats, 1)
If Trim(arrCats(I)) = Trim(arrRequiredCats(J)) Then
intMatchCount = intMatchCount + 2
If intMatchCount >= intReqCats Then
Exit For
End If
End If
Next
If intMatchCount >= intReqCats Then
Exit For
End If
Next
End If
HasRequiredCategory = (intMatchCount >= intReqCats)
Exit Function
'Error Handling Routine
Error_Handler:
'Handle the error
MsgBox "Please select categories as instructed in the Red Box located to the
left of the Categories box"
Exit Function
End Function