Some time ago, David Jondreau shared a helpful tip on this forum regarding being able to determine the error behind ExecuteSql's "dreaded ?".
Here is the link to the resource. Perhaps it will be of help to you:
I 'd take a close look at the line:
WHERE ilgiid LIKE 'MS-%' AND NOT LIKE 'MS-JA%' AND ilgdat BETWEEN ? AND ?
It seems to me you might need something more like:
WHERE ilgiid LIKE 'MS-%' AND ilgiid NOT LIKE 'MS-JA%' AND ilgdat BETWEEN ? AND ?
i.e. include your field name before the NOT LIKE clause.
Hope this helps,
Thanks Steve. That was it.