473,386 Members | 1,943 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,386 software developers and data experts.

Can you search a table name in queries?

Let's see if I can ask this without confusing you or myself.

I need to be able to type a tablename into a box, and search my entire
database to see which queries are using that table.

Is this even possible?

Aug 24 '06 #1
4 3708
"ManningFan" <ma********@gmail.comwrote in message
<11**********************@74g2000cwt.googlegroups. com>:
Let's see if I can ask this without confusing you or myself.

I need to be able to type a tablename into a box, and search my
entire database to see which queries are using that table.

Is this even possible?
I would think you could loop the querydefs collection, then investigate
the SQL property of each of them using for instance the InStr function.
air code

sub testing(byval v_strTable as string)

dim qd as dao.querydef
dim db as dao.database

set db = dbengine(0)(0)
for each qd in db.querydefs
if instr(1, qd.sql, v_strTable, vbtextcompare) 0 then
debug.print "found in " & qd.name
end if
next qd
set qd = nothing
set db = nothing

end sub

A search in this NG would probably find a plethora of more advanced
routines to do something like that, including checking for the
tablename
in dynamic sql/code, rowsources, recordsources ...

--
Roy-Vidar
Aug 24 '06 #2
See if this query helps:

SELECT MSysObjects.Name
FROM MSysQueries INNER JOIN MSysObjects
ON MSysQueries.ObjectId = MSysObjects.Id
WHERE MSysQueries.Expression Like "*" & [qryName] & "*"
GROUP BY MSysObjects.Name;

There are tools that help trace dependencies. Here's a freebie:
Renaming fields and tracing dependencies a utility by Chas Dillon
at:
http://allenbrowne.com/ser-41.html

Here's a commercial one:
http://www.speedferret.com/

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"ManningFan" <ma********@gmail.comwrote in message
news:11**********************@74g2000cwt.googlegro ups.com...
Let's see if I can ask this without confusing you or myself.

I need to be able to type a tablename into a box, and search my entire
database to see which queries are using that table.

Is this even possible?

Aug 24 '06 #3
I ended up using some code I found on
http://www.dbforums.com/t677218.html but I had to modify it a bit. I
combined it with code found on
http://www.mvps.org/access/queries/qry0002.htm to produce a form that
gives people entirely too much information. But hey, that's what they
wanted so as long as they're happy...

Allen Browne wrote:
See if this query helps:

SELECT MSysObjects.Name
FROM MSysQueries INNER JOIN MSysObjects
ON MSysQueries.ObjectId = MSysObjects.Id
WHERE MSysQueries.Expression Like "*" & [qryName] & "*"
GROUP BY MSysObjects.Name;

There are tools that help trace dependencies. Here's a freebie:
Renaming fields and tracing dependencies a utility by Chas Dillon
at:
http://allenbrowne.com/ser-41.html

Here's a commercial one:
http://www.speedferret.com/

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"ManningFan" <ma********@gmail.comwrote in message
news:11**********************@74g2000cwt.googlegro ups.com...
Let's see if I can ask this without confusing you or myself.

I need to be able to type a tablename into a box, and search my entire
database to see which queries are using that table.

Is this even possible?
Aug 24 '06 #4
Allen Browne wrote:
See if this query helps:

SELECT MSysObjects.Name
FROM MSysQueries INNER JOIN MSysObjects
ON MSysQueries.ObjectId = MSysObjects.Id
WHERE MSysQueries.Expression Like "*" & [qryName] & "*"
GROUP BY MSysObjects.Name;

There are tools that help trace dependencies. Here's a freebie:
Renaming fields and tracing dependencies a utility by Chas Dillon
at:
http://allenbrowne.com/ser-41.html

Here's a commercial one:
http://www.speedferret.com/
Good stuff. My compliments to the chef(s)!

--
Smartin
Aug 25 '06 #5

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

Similar topics

5
by: Greg | last post by:
I have a page that searches a database by a repairman's name and by a date range. It pulls info by the repairman's name but pulls all info in the database regardless of the date. Below is the code...
11
by: Adrian Parker | last post by:
I have a database of 200+ tables (two tables per school), each with 100 - 4000 records (one record per student). A contract I'm looking at wants to be able to do a search across all the tables,...
6
by: Alan | last post by:
I'm just about to start a project that needs to combine the results of a SQL Server query with the results of an Index Server query. The basic idea is that the user enters/selects a bunch of search...
1
by: Mooky Mooksgill | last post by:
I would like to search a table for a phrase, or for a partial phrase, eg on table product - for name or description, or name + descprition. How does one say select * from product where name +...
2
by: Zambo via SQLMonster.com | last post by:
Hi! We have Sql Server 2000 in our server (NT 4). Our database have now about +350.000 rows with information of images. Table have lot of columns including information about image name, keywords,...
3
by: RiceGuy | last post by:
Hi! I'm looking for ideas on what would the best approach to design a search system for a RSS feeds. I will have some 50 RSS feeds (all RSS 2.0 compliant) stored locally on the web server. Now I'm...
3
by: Colleyville Alan | last post by:
I have a incremental search box that has been working fine for a couple of months but is now acting up. This search box is from the cd that comes with Getz's book, so I did not write it and have...
6
by: simon.robin.jackson | last post by:
Ok. I need to develop a macro/vba code to do the following. There are at least 300 corrections and its expected for this to happen a lot more in the future. Therefore id like a nice...
4
by: Evanescent | last post by:
Hi Guys, I am trying to create a form which allows the users to retrieve records based on the values entered or chosen in the various combo boxes and textboxes, such as the customer's name, invoice...
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: 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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.