> Have you tested it as a query in Access? Your query may be too complex
> for Jet.
>
> Why don't you create a query in Access?
thanks for the reply. Yes the query does run in access if i copy and paste
the debug.print sql to the access sql window. ok so perhaps nested queries
are too complex for jet or is there a better way to write the sql that will
be supported by jet?
i have not defined the query in access because i need to populate a combo
box depending on who the user is (strName in the where statement). is there a
way a can do this from access instead - pass the strName variable to an
access query?
regards, bob
Stefan Hoffmann - 14 Mar 2007 16:15 GMT
hi Bob,
> thanks for the reply. Yes the query does run in access if i copy and paste
> the debug.print sql to the access sql window. ok so perhaps nested queries
> are too complex for jet or is there a better way to write the sql that will
> be supported by jet?
Yes, try an INNER JOIN instead of your sub-queries, e.g.
SELECT DISTINCT U.[Team Leader]
FROM tblUserData U
INNER JOIN tblUserData P ON P.Position = U.Position
INNER JOIN tblUserData T ON T.Team = U.Team
WHERE NOT IsNull(U.[Team Leader])
AND U.Name =""
AND T.Name =""
A also use [Name] as it is a reserved word.
mfG
--> stefan <--
bobm - 15 Mar 2007 03:25 GMT
stefan, thanks for your help ...appreciate it.
got the same error with your sql. after individually writing tbe queries
found that position is a reserved word so had to square bracket it. now all
queries work.
cheers, bob