vba - Export MS Access queries to notepad -
i want export queries (names query code) notepad/word document. i'm not @ vba code found code site in web exports queries query code notepad. code:
sub exportqueries() dim db object dim qdf object dim ff long set db = currentdb ff = freefile() open "c:\queries.txt" output #ff each qdf in db.querydefs print #ff, "query: " & qdf.name & vbcrlf print #ff, "sql:" & vbcrlf print #ff, qdf.sql & vbcrlf next qdf close #ff end sub but want export queries in macro i'm using. how extract queries used in specific macro? can give me code plz?
my macros - alerts_mcr ebac_mcr there few more macros i'm using.
to programmatically describe in robust way non-trivial exercise. resulting vba code have :
take list of macros,
inspect each action of each macro see if invokes query, either directly (e.g., via
openquery) or indirectly (e.g., doingruncodecalls vba function invokes query),parse queries invoked see if they invoke other queries, again either directly (via
fromclause) or indirectly (e.g., via vba function), , recursively, andalso check see if macros call other macros and, if so, same thing them.
all of makes interesting development project, (imo) beyond scope of stack overflow q+a format.
Comments
Post a Comment