Script works only when I have Messagebox

Hello,

I am looking up 2 fields on the same form to check their values. If the first field’s value is more than zero and the second field is empty it writes the contents of another field to the second field. If it’s not empty I have code in an Elseif to append the contents instead.

It works great only if I put a Messagebox statement straight after the call to append i.e

hours = uidoc.FieldGetText( “m2f_act1_1” )

empty = uidoc.FieldGetText( "montofripeople" )

If ( hours > 0 And empty = "" ) Then

	Call uidoc.FieldAppendText _

	( "montofripeople", uidoc.FieldGetText( "app_Name_1" ))

Messagebox twoLiner, MB_OK, uidoc.FieldGetText(“app_Name_1” )

As soon as I remove the messagebox it stops writing to the field. Am I missing something? Can anyone help? Thanks in advance.

Subject: Script works only when I have Messagebox

try refeshing the doc…(I also included this as part of the IF, otherwise you will be wasting processing time by refreshing un-necessarily.

hours = uidoc.FieldGetText( “m2f_act1_1” )

empty = uidoc.FieldGetText( "montofripeople" )

If ( hours > 0 And empty = "" ) Then

	Call uidoc.FieldAppendText _

	( "montofripeople", uidoc.FieldGetText( "app_Name_1" ))

	call uidoc.refresh

end if

Subject: RE: Script works only when I have Messagebox

Fantastic…, that’s working for me now David.

Many thanks,

Phil.