You are right, the code that is in there now was not what you sent, but I just copied and pasted what you had sent earlier, but I had to change it back to get the first part to work. When I used your code for the stLinkcriteria, is when I got the data type mismatch