There is nothing obviously wrong with the SQL ( but it never is obvious is
it ;-) ).
As a general principal assign your SQL string to a variable and make that
variable the argument of openrecordset. This :
- lets you inspect the actual value of the string which may identify
problems with the syntax of SQL concatenations, especially where they go
over one line,
- makes it easier to step through the code to see just where the error
happens.
The error may not be where you think. Have you stepped through the code in
this case, does the error throw on the openrecordset call?
BTW your SQL could be made easier to read and to verify by simplification.
Instead of
WHERE (((oldlab.Partno)="60a13068") AND ((oldlab.Jobno)="23289"));
you could use
WHERE Partno="60a13068" AND Jobno="23289"
but then you can't paste in SQL that Access has generated in the query
builder. YMMV
David