Win32 Exception Error

B

Becks Watkinson

Heya

I've got a form field which runs a macro on exit to select the next field
(as its not the next one on the set Word tab order).
If you are on this form field and click another form field, it selects the
correct field as it should. However if you click on a drop down combo or
checkbox instead, it selects the form field and finishes the End Sub
correctly but afterwoods Word comes up with an unhandler Win 32 Exception
Error and shuts down.

Does anyone know what might be causing this or how to get round it ?

Thanks and regards,
Becks
 
D

dz

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
 
B

Becks Watkinson

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
 
G

Guest

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
 
B

Becks Watkinson

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 !
 
D

dz

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. (e-mail address removed).
Change com to net (I'm trying to avoid those stupid auto
scripts that find email addresses).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top