Debug changing spelling of variable values

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??

Subject: RE: Debug changing spelling of variable values

If sounds like a refresh is happening (why else would Postrecalc run?). You said docStatus is a computed field. What is its formula? I have a feeling it should be a computed when composed field instead!

Subject: RE: Debug changing spelling of variable values

docStatus is not a field, it’s a variable that gets assigned the value of the field…

Dim docStatus As String

docStatus = thisDoc.WFStatus(0)

This only gets set once.

WFStatus is a computed when composed field. Here’s it’s default value…

@If(@IsNewDoc; “Draft”; @ThisValue)

when this line of code runs,

If Not (thisUIDoc.EditMode) Then

thisUIDoc.EditMode = True

End If

I notice that it changes the spelling of the docStatus value. No idea why. I’m assuming it’s a bug. Even if refresh runs, why would it change the spelling of a variable in code?

Has to be a bug. Nothing else touches it. I hope this is not wide spread in designer.