Here is a useful SQL query I made for finding which modules (in the DotNetNuke “DesktopModules” directory) are on a given tabID. Please note that I only ever run this query manually in SQL Server Management Studio, it’s not used in code:

select *
from dnn_TabModules tabmods INNER JOIN dnn_Tabs tabs ON tabmods.TabID = tabs.TabID
INNER JOIN dnn_Modules mods ON tabmods.ModuleID = mods.ModuleID
INNER JOIN dnn_ModuleDefinitions moddefs ON mods.ModuleDefID = moddefs.ModuleDefID
INNER JOIN dnn_DesktopModules dtmods ON moddefs.DesktopModuleID = dtmods.DesktopModuleID
where tabs.TabID = 123

Simply change the “where” accordingly. Similarily by replacing the where-clause with ..
where FolderName = ‘SomeDesktopModule’

.. you find the tabdID’s where said module is used. This should work in DotNetNuke 4.* atleast.