I am only drawing straws here and guessing, but shouldn't this portion of the SELECT statement be
" ' + CatID$ + ' " instead of '" + CatID$ + "'. It's a little hard to tell from my browser which set of quotes you have first, but it looks like the single quotes are first with the double quotes inside and it seems like this should be just the opposite.
This may not be the problem at all, but sometimes it is the small things that we overlook :-)
HTH,
Gary
" ' + CatID$ + ' " instead of '" + CatID$ + "'. It's a little hard to tell from my browser which set of quotes you have first, but it looks like the single quotes are first with the double quotes inside and it seems like this should be just the opposite.
This may not be the problem at all, but sometimes it is the small things that we overlook :-)
HTH,
Gary