Tom,
When you are trying to track down bugs in your code like this, separate things out so you can more easily find the error:
? casema.caseid
? type( "casema.caseid" )
? alltrim(casema.caseid)
? superid
? type( "superid" )
? alltrim(superid)
A lot of this information could be more easily gleaned by suspending the code and hovering the mouse over these items in the trace window or looking at them in the locals or watch window.
>I did exactly that, so I copied and pasted what you have given me, but it still returns datatype mismatch...