You said that you use the DataEnvironment. Have you tried the SQL Query builder which is supposed to create right query? It may be of great help!
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com