The @ERROR macro only contains the most recent error code, you are only checking for an error after the third function you are calling, you should be checking after each one. It would be easier for us to help you if you post the ENTIRE script and not expect us to try to guess what is happening.
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)