Here is how you get a list of queries in an Access mdb from a vb6 app
(this works the same in a vb.net app except that you have to cast the
Access Object using CType or DirectCast):
First you need to make a reference to the Microsoft Access X Object
Library, then make another reference to the Microsoft DAO 3.x Object
Library
then add this code
Private Sub Command1_Click()
Dim accObj As Access.Application, QD As QueryDef
Dim DB As Database
Set accObj = GetObject("C:\test.mdb", "Access.Application")
'or if you use CreateObject then need to open current DB
'accObj.OpenCurrentDatabase ("C:\test.mdb")
Set DB = accObj.CurrentDb
For Each QD In DB.QueryDefs
Debug.Print QD.Name
Next
End Sub
Rich
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!