VB code flows randomly (2000)

I'm trying to modify some VB code that's in the 'On Lost Focus' event for a field. The code that I am providing here has been reduced in complexity for illustration, but still reproduces the problem. For instance, I have explicitly assigned values to the PNIEndValue and PNIStartValue variables, rather than involving outside code to do so.

When this code is invoked, it starts off by bouncing back and forth between PNIEndValue = "ICA" and PNIStartValue = "PNI-Official Check" -- although I can see it flash very very briefly on If PNIEndValue <> PNIStartValue while it's doing this. After doing this about 30 times, it finally does travel down line by line, all the way to End Sub, but then loops part of the way way up and repeats this for a couple of dozen times.

The funny thing is that all of this is transparent to the users. It works from the form as originally designed. I just noticed it acting this way because I need to make some modifications, but can't until I can get it stabalized.

I have compacted, repaired, decompiled, deleted other events (for now) ... what else should I try to debug this?

Re: VB code flows randomly (2000)

Unfortunately, I think we need more information to determine exactly what is going on with you code. It appears to me to be behaving more or less as I would expect, but there may be other code involved that is setting focus back to the control with retriggers the code with loss of focus, so you appear to have an endless loop.

In particular, it would be useful to know if this is some sort of validation routine for a control. Also, it would be useful to know what the various referenced controls are supposed to represent. In particular these controls appear to be key:
Me![PNIInfo
Me![txtBkgCtrContactName
Me![Welcome]

Have you tried stepping through it with the de###### to see if it appears to be behaving correctly? I suspect there is some other code getting in on the act.