473,382 Members | 1,336 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

List queries under a Macro (vb6.0)

I am would like to get the list of queries that make a macro in
MS-Access using vb 6.0.

Nov 13 '05 #1
3 2423
Here is how you get a list of queries in an Access mdb from a vb6 app
(this works the same in a vb.net app except that you have to cast the
Access Object using CType or DirectCast):

First you need to make a reference to the Microsoft Access X Object
Library, then make another reference to the Microsoft DAO 3.x Object
Library

then add this code

Private Sub Command1_Click()
Dim accObj As Access.Application, QD As QueryDef
Dim DB As Database
Set accObj = GetObject("C:\test.mdb", "Access.Application")

'or if you use CreateObject then need to open current DB
'accObj.OpenCurrentDatabase ("C:\test.mdb")

Set DB = accObj.CurrentDb
For Each QD In DB.QueryDefs
Debug.Print QD.Name
Next
End Sub
Rich

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #2

Rich P,

This will get me the name of ALL the queries in the DB.

I just need the name of the queries that are used within the Macros of
the DB.

Assume I have the following queries in the DB.
Q1
Q2
Q3
Q4
Q5
and a Macro "M1" using(OpenQuery) queries Q1, Q2
and Maco "M2" using(OpenQuery) queries Q3
I just want to return the queries names that are used in
Macro "M1" and "M2".
In this case it will be Q1, Q2, Q3

Thanks in advance,
Julio
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #3

an*******@devdex.com wrote:
Rich P,

This will get me the name of ALL the queries in the DB.

I just need the name of the queries that are used within the Macros of the DB.

Assume I have the following queries in the DB.
Q1
Q2
Q3
Q4
Q5
and a Macro "M1" using(OpenQuery) queries Q1, Q2
and Maco "M2" using(OpenQuery) queries Q3
I just want to return the queries names that are used in
Macro "M1" and "M2".
In this case it will be Q1, Q2, Q3

Thanks in advance,
Julio


AFAIK, you can't. No idea how or where macros store that info...
Maybe MichKa does. Check the MS site or www.trigeminal.com (long shot
there...)

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used...
4
by: italiak | last post by:
Hello everyone- I have these 500 queries in access. They all do the same thing (append data from big database to a table) and have similar condition. I was wondering if there is a way I can...
0
by: MHenry | last post by:
Hi, I know virtually nothing about creating Macros in Access. I would appreciate some help in creating a Macro or Macros that automatically run(s) 14 Queries (three Make Table Queries, and 11...
3
by: matthewemiclea | last post by:
I am trying to display information in Access on a form that takes information from many different queries and puts them together on a spreadsheet or chart. Some specific info: The information I...
0
by: skinnybloke | last post by:
Hi I have written 3 seperate macros in access to run 3 queries to export 3 .xls files. Sometimes I will need to run them individually. Sometimes I will need to run them all together...
5
by: HS Hartkamp | last post by:
Hi all, I am working with fairly large databases (> 500 Mb / < 2,000,000 rexcords), and often need to do action queries on these. I have the feeling that much of the computing power is going...
0
by: doninsbca1 | last post by:
I want to start at the macro level (or query level) and document the queries, sub-queries, and tables that macro or primary query uses. I don't want to have a documenter that goes down one level...
3
by: swb76 | last post by:
Hi, I have 6 queries in Access that run great. They need to be run in sequence with the first 5 queries writing to tables and the sixth one pops up the final results in datasheet view. Now, how...
7
by: luciquar | last post by:
I am a PhD student in demography and I am working with a Microsoft Access database in which I have to use several update queries. Amongst these there are some in which I have to update the value of...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.