I know this sounds dumb, but... since I have no idea how
you "select the next field," does your macro have an end
code in it? In other words...
Sub yoursubname()
your code here
end
end sub
Don't know if it will help, but it sounds like your code
might not be taking itself out of the buffer and then it
gets confused with the drop down box.
Without knowing the specifics, that's all I can offer at
the moment.
dz
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
> I know this sounds dumb, but... since I have no idea how
> you "select the next field," does your macro have an end
[quoted text clipped - 40 lines]
> >
> >.
If I'm understanding your code correctly, instead of going
to the "tabbed" field with your code of:
ActiveDocument.Bookmarks(strFldToGoTo).Range.Fields
(1).result.Select
try the below code instead.
Selection.GoTo What:=wdGoToBookmark, Name:=strFldToGoTo
dz
>-----Original Message-----
>Dz,
[quoted text clipped - 136 lines]
>
>.
Becks Watkinson - 30 Oct 2003 11:03 GMT
Thanks Dz,
This option is used because of the MVP Word discussion
http://www.mvps.org/word/FAQs/TblsFldsFms/GotoFormField.htm.
However, even with changing to your suggested code, it still falls over.
It seems to be picking up the new form field correctly and each time crashes
after the original sub routine End Sub.
I've tried Do Events etc etc but still no joy.
This is killing me !
> If I'm understanding your code correctly, instead of going
> to the "tabbed" field with your code of:
[quoted text clipped - 167 lines]
> >
> >.
dz - 31 Oct 2003 02:00 GMT
I'm out of ideas without the actual document. Is there
any way you can make it generic (so no confidential
information is given) and email it to me? I'd be happy to
take a look at it. zivd@cox.com.
Change com to net (I'm trying to avoid those stupid auto
scripts that find email addresses).
>-----Original Message-----
>Thanks Dz,
[quoted text clipped - 182 lines]
>
>.