473,698 Members | 2,181 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2436
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.Applicat ion, QD As QueryDef
Dim DB As Database
Set accObj = GetObject("C:\t est.mdb", "Access.Applica tion")

'or if you use CreateObject then need to open current DB
'accObj.OpenCur rentDatabase ("C:\test.md b")

Set DB = accObj.CurrentD b
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*******@devde x.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
6771
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 the SQL Profile to watch the T-SQL-Command which Access ( who creates the commands?) creates and noticed:
4
9832
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 create a macro to modify the content of these queries. If the modify macro is not possible then I can delete the queries and try to create a macro which can create queries from scratch. Any help is appreciated.
0
8775
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 Append Queries) when the Database is first opened, and then again anytime I invoke the Macro (somehow) after the database is already open. The latter function is useful, because the queries must be rerun every time data is added, deleted, or...
3
12728
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 am displaying consists of a work order schedule(for the current date), work orders completed , work orders not completed, a past due schedule, past due completed, and past due not completed. These are grouped by workcenters. Therefore, one...
0
1037
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 therefore I have written a top level macro to run the 3 macros.
5
10646
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 into building a table of changes so that you can be prompted "Are you sure to change xx records", and be able to reply no. I regularly get messages that say "Insufficient memory or disk space, you won't be able to undo; continue?"
0
1282
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 only, because then I have to go to each query used in the macro and document that, then go to each query or used in THAT query and document the queries or tables used . . . etc. Gives me a headache. I want: Macro 1 . . . query 1 . . . . . . ....
3
16219
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 can i automate this process? I started with the simple macro builder and entered all 6 queries perfectly fine. However, i want to prompt the user if they wish to run queries 1 & 2, if they say no, it should move to 3 and run the remaining ones....
7
4452
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 a field in a row to the value of the same field from the previous row (according to some parameters). For example: UPDATE INNER JOIN AS ON .ID = .ID SET .Variable = . WHERE (((.Variable) Is Null) AND ((.Order)=.+1) AND ((.Variable) Is Not...
0
8671
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8598
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9016
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8887
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8856
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5858
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4360
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2321
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1997
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.