Dz,
Sorry to be thick but why would I need to use End on its own ?
Mind you, it didn't work anyway !
Whats wierd is that if you click out onto a normal form field it runs ok,
but not for checkboxes and drop downs whether they have an exit macro or
not.
It finishes the Claims_PR 'End Sub' and then bombs out with "the instruction
at "0x3003f056" referenced memory at "0x000000010" the memory could not be
"read"" error.
I have put full error handling in and at no point does either of the
routines raise an error.
Any ideas?!
____________________________________________________________________________
________
Here's the code :
Sub Claims_PR() 'Called from the exit macro
On Error Resume Next
'Check the property claims field have been entered if property limits have
been entered
If ActiveDocument.FormFields("xblnPR").CheckBox.Value Then
RequiredClaimsField
End If
ClaimsTabOrder 'Works out which form field is next and goes to it.
End Sub
Private Sub ClaimsTabOrder()
On Error Resume Next
'Forces the tab order on the Loss History form
Dim strFldToGoTo As String
Dim intLoop As Integer 'Which record set
Dim strPrefix As String
Dim strSuffix As String
'Clear Words undo as other wise get can't undo errors
ClearMemory
SetFieldName
intLoop = CInt(Mid(strFieldName, Len(strFieldName) - 1, 1))
strPrefix = Left(strFieldName, InStr(strFieldName, "_") - 1)
'Then find out which formfield to go to next ...
If InStr(strFieldName, "From") <> 0 Then 'Year From
strPrefix = strPrefix & "_To"
ElseIf InStr(strFieldName, "To") <> 0 Then 'Year To
strPrefix = "clProp_Paid"
ElseIf InStr(strFieldName, "Paid") <> 0 Then
strPrefix = strPrefix & "_OS"
ElseIf InStr(strFieldName, "OS") <> 0 Then
strPrefix = strPrefix & "_No"
Else 'No of claims - move down to next set of figures
Select Case strPrefix
Case "clProp"
strPrefix = "clAuto_Paid"
Case "clAuto"
strPrefix = "clGL_Paid"
Case "clGL"
strPrefix = "clLaw_Paid"
Case "clLaw"
strPrefix = "clAL_Paid"
Case "clAL"
strPrefix = "clEO_Paid"
Case "clEO"
strPrefix = "clEmployment_Paid"
Case "clEmployment"
strPrefix = "clSexual_Paid"
Case "clSexual"
strPrefix = "clEBL_Paid"
Case "clEBL"
strPrefix = "clWCEL_Paid"
Case "clWCEL"
strPrefix = "clCrime_Paid"
Case "clCrime"
strPrefix = "clYear_From"
intLoop = intLoop + 1
End Select
End If
strFldToGoTo = strPrefix & intLoop & "M"
'... and go to it.
ActiveDocument.Bookmarks(strFldToGoTo).Range.Fields(1).result.Select
End Sub