Is there a way to find out all the tables used in a saved access query? Currently I do something like:
But this doesn't always work. ie I have a make table query and it didn't return any SourceTables for it. Any help would be great thanks.Code:Dim qry As DAO.QueryDefs Set qry = db.QueryDefs For i = 0 To qry.Count - 1 tvDBObjects.Nodes.Add "QUERIES", tvwChild, qry(i).Name, qry(i).Name For j = 0 To qry(i).Fields.Count - 1 If PrevTable <> qry(i).Fields(j).SourceTable Then tvDBObjects.Nodes.Add qry(i).Name, tvwChild, , qry(i).Fields(j).SourceTable PrevTable = qry(i).Fields(j).SourceTable DoEvents End If Next DoEvents Next
-Rick




Reply With Quote