A Allen Browne Jul 2, 2009 #2 samp said: how can I know from VBA which Data Base is pointing a query "create table" Click to expand... I think you are asking how you can tell programmatically which queries are action queries? Try something like this: CurrentDb.QueryDefs("Query1").Type It should return the value of dbQMakeTable for your 'create table' type query. For other values, open the code window, and press F2 to open the Object Browser. Search for dbQAppend etc.
samp said: how can I know from VBA which Data Base is pointing a query "create table" Click to expand... I think you are asking how you can tell programmatically which queries are action queries? Try something like this: CurrentDb.QueryDefs("Query1").Type It should return the value of dbQMakeTable for your 'create table' type query. For other values, open the code window, and press F2 to open the Object Browser. Search for dbQAppend etc.
A Allen Browne Jul 2, 2009 #4 You will need to examine the SQL property of the QueryDef, e.g.: Debug.Print CurrentDb.QueryDefs("Query1").SQL It will look something like this: SELECT Table1.* INTO Table2 IN 'C:\Data\AccessOutput.mdb' FROM Table1; Parse the string to read the database it is IN.
You will need to examine the SQL property of the QueryDef, e.g.: Debug.Print CurrentDb.QueryDefs("Query1").SQL It will look something like this: SELECT Table1.* INTO Table2 IN 'C:\Data\AccessOutput.mdb' FROM Table1; Parse the string to read the database it is IN.
S samp Jul 2, 2009 #6 it thus: ?Right("SELECT Table1.* INTO Table2 IN 'C:\Data\AccessOutput.mdb' FROM Table1", InStr("SELECT Table1.* INTO Table2 IN 'C:\Data \AccessOutput.mdb' FROM Table1","'")+5)
it thus: ?Right("SELECT Table1.* INTO Table2 IN 'C:\Data\AccessOutput.mdb' FROM Table1", InStr("SELECT Table1.* INTO Table2 IN 'C:\Data \AccessOutput.mdb' FROM Table1","'")+5)