Error Loading USE or USELSXAfter nearly punching a hole in my computer monitor recently, I learned something that I thought I'd share with all of my readers. (and it's not "don't punch a hole in your computer monitor").
I was working on an application that has a lot of LotusScript code in forms, views, agents, script libraries, and everywhere else. I was trying to update a form but was getting the "error loading USE or USELSX" error. Notes couldn't bring in one of the script libraries. OK. That's fine. I've seen that before. I commented out the script library and the function calls in the script library so I was able to save my form. I went back in, removed the comments from everything, and got the same error.
OK. Corruption in the script library I thought. So I went into the script library, added a line to the (Options) section (which will force a recompile) and saved it. Then I went back into the form and got the same error. At this point I'm a bit confused.
I decided to use the Designer action of recompiling all LotusScript. It started pass 1 (building the dependency list) and got hung up - no response, no crash, nothing - on that script library. I had to kill Notes. After restarting, I went into the administrator client and ran a fixup and compact on the database. No errors were reported. I went back into designer, saved the script library again, but the form still was giving me the same error.
So I tried to recompile all LotusScript again. And again everything hung up on pass 1 on that script library. Argh! Kill Notes and restart again.
Next, I built a brand new script library. Called it something slightly different than the original (so I wouldn't have duplicates) and copied over all the code from the original to the new one. I tried to include that new script library in the form and got the same error again. Now this is getting really fishy.
So I tried to create a brand new form. I included that script library and got the same error. So I tried another script library and everything worked fine. I tried another. Worked fine. Tried another. Got the error again. Hmm. Wait a minute - that last script library is also included in the original script library.
Then I went into that second script library, added a line to the (Options) section, then saved the library. I went back in to my new test form and was able to include that second script library. I then went back to the original script library, added a line to the (Options) section and saved that script library. Went back to my new test form and was able to include the original script library. Went back to the original form and was able to include the original script library. Yea! I can save my form after yelling at my computer for a couple of hours.
So, the moral of the story is that the "Error loading USE or USELSX", when a corrupt script library is involved, could in fact be a corrupt "sub-script library". The one that looked to me like it was the problem was only that way because one of the libraries it brings in was corrupt. Fixing the real corrupt library by recompiling it ended up fixing the corruption in the original.
By the way, after updating the form, I recompiled all LotusScript again and it ran through as expected. My blood pressure then went back to normal...