Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access: list query dependencies

Tags:

ms-access

With the help of this answer, I created a report to list all queries in the current db, with their input tables/queries, and their output (for Actions queries).
I have been very happy with it, until I noticed that some queries are missing in the result.
I am a bit stuck on why.
Any clue ?

SELECT MSysObjects.Name AS queryName, 
  Mid("SelectMakTblAppendUpdateDeleteXtab  777777PassThUnion ",([msysqueries]![Flag]-1)*6+1,6) AS queryType, 
  src.Name1 AS [Input], 
  MSysQueries.Name1 AS Target, 
  MSysQueries.Attribute
FROM (MSysQueries INNER JOIN MSysObjects ON MSysQueries.ObjectId = MSysObjects.Id) 
LEFT JOIN (SELECT * FROM MSysQueries WHERE Attribute = 5)  AS src ON MSysQueries.ObjectId = src.ObjectId
WHERE (((MSysObjects.Name)>"~z") AND (MSysQueries.Attribute=1))
ORDER BY MSysObjects.Name, src.Name1

EDIT: found that against all logic, INNER JOIN MSysObjects ON MSysQueries.ObjectId = MSysObjects.Id sometimes does not return every line it should.
I checked both MSysQueries and MSysObjects and made sure I had same object id -2147483618 on both sides, I made sure that MSysQueries has a line for that ObjectId where Attribute=1, however, when joining the tables, that specific line with attribute=1 does NOT appear. Very strange. I tried to use an inner join, to replace the JOIN by a criteria, adding Val or CLng in the process, no way. I am lost here.

EDIT 2: found a way to correctly "join" both tables by using where CStr([Id]) = CStr([ObjectId]).
But that should really not be necessary !

like image 734
iDevlop Avatar asked Jan 10 '23 01:01

iDevlop


1 Answers

Access does have a built in “dependency” feature. The result is a VERY nice tree-view of those dependencies, and you can even launch such objects using that treeview of your application to “navigate” the application so to speak.

The option is found under database tools and is appropriately called Object Dependencies.

The result looks like this: enter image description here

While you don't want to use auto correct, this feature will force on track changes. If this is a large application, then on first run a significant delay will occur. After that, the results can be viewed instantly.

like image 163
Albert D. Kallal Avatar answered Feb 12 '23 05:02

Albert D. Kallal