Hi, is there a way to get the names of the tables used in a query?
i have a combobox in which i select a query, can i feed another combobox with the tables used in the query in the first combobox?
thanks
Hi, is there a way to get the names of the tables used in a query?
i have a combobox in which i select a query, can i feed another combobox with the tables used in the query in the first combobox?
thanks
Give this a look: https://social.msdn.microsoft.com/Fo...orum=accessdev
this is witchcraft
I've recently updated a lengthy article about how Access stores queries: How Access Stores Queries - 1 (isladogs.co.uk)
The information you need is indeed stored in a system table called MSysQueries
The articles included many examples that should show you how this is done.
In essence, the Name1 field for Attribute5 gives the list of tables used in each query
It may be witchcraft to you but that is how its done in Access.
If you want that information in code that is how you need to obtain it
this is even more witchcraft i found the solution, thanks both, very nice stuff
sure, i thought it was clear, cause i just copied the query
the only difference is in the WHERE clause:Code:SELECT MSysQueries.Name1 AS DataSource FROM MSysObjects INNER JOIN MSysQueries ON MSysObjects.Id = MSysQueries.ObjectId WHERE (((MSysObjects.Name)=Forms!ricerca!tabella1cb) And ((MSysQueries.Attribute)=5)) ORDER BY MSysObjects.Name, MSysQueries.Name1;
my solution
original solution:Code:WHERE (((MSysObjects.Name)=Forms!ricerca!tabella1cb) And ((MSysQueries.Attribute)=5))
cause i want the tables of a specific query, not every queryCode:WHERE (((MSysObjects.Name) Not Like "~sq*") AND ((MSysQueries.Attribute)=5))