Cercare una query tra gli n database
per comodità abbiamo ristretto il campo alla directory corrente, ma è chiaro che può essere esteso ai path che si vuole
Public Sub Ricerca()
Dim MyPath As String
Dim MyName As String
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim strPath As String
MyPath = Application.CurrentProject.Path & "\"
MyName = Dir(MyPath)
Do While MyName <> ""
If Right(MyName, 3) = "mdb" Or Right(MyName, 5) = "accdb" Then
Set db = Application.DBEngine(0).OpenDatabase(MyPath & MyName)
For Each qdf In db.QueryDefs
If qdf.Name = "tuaQuery" Then MsgBox "trovato: " & MyName
Exit Sub
Next
End If
MyName = Dir
Loop
End Sub