I thought you were trying to
read the sql, not
create or modify it.
As an alternative:
Use the MSysQueries table as Michael Redd suggested in one recent post.
Detect the query ID from MSysObjects table on the basis of the query name and type (5)
Open an ADO recordset based on MSysQueries filtered by ObjectID.
Play a little with the Attributes column: source table(s) are marked as 5, fields are marked with 6, joins with 7, conditons with 8, it's up to you to find 'group by', 'having' and anything else.
I have not yet used it, but it's something that I keep in mind...just in case.
You can rebuild the SQL of the query in this way...
And you use an ADO connection after all
Good luck
![[pipe] [pipe] [pipe]](/data/assets/smilies/pipe.gif)
Daniel Vlas
Systems Consultant