Issue with debug mode and variable values changing …
I have a workflow type of form. To make long story short and without posting all my code…
The document is not in edit mode when opened. When in the doc, I click the approval button, debug starts.
The code takes the status of the document (computer field) and assigns it to a string variable called “docStatus” … no problem.
Then, in the flow of code, I put into edit mode…
If Not (thisUIDoc.EditMode) Then
thisUIDoc.EditMode = True
End If
When “thisUIDoc.EditMode = True” is called, I see the PostRecalc event being called, though there is no code in it.
Then I noticed that the spelling of the string in docStatus variable has changed!!! Nothing else has touched that variable!! There are no defaults in any fields with the strings I am working with, all are set in code depending on flow.
I tried putting messageboxes before and after …
Msgbox docStatus,,"before"
If Not (thisUIDoc.EditMode) Then
thisUIDoc.EditMode = True
End If
Msgbox docStatus,,"after"
I can see the correct spelling in the msgbox before the edit call … “Final Notification”
then the msgbox after the call has a messed up spelling!! …
“Final Notifieation” or “Final Notifidation”, or etc!!!
When I run this out of debug mode, it’s ok, but when I run it in debug mode, it losses spelling!! This is the same with different workflow strings.
This is a headache because I need to debug my code, but if debug is going to magically change my variables… that’s no good. Does debug have a debug!!!
Has anyone else ran across this??