A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Find Text in a Query



 
 
Thread Tools Display Modes
  #1  
Old March 6th, 2010, 10:10 PM posted to microsoft.public.access
PeterM
external usenet poster
 
Posts: 208
Default Find Text in a Query

Does anyone know of a way to search thru AC2003 queries to find a text
string? For example, I need to find all queries that contain the text
"Forms".

Thanks for your help!
  #2  
Old March 6th, 2010, 11:43 PM posted to microsoft.public.access
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Find Text in a Query

On Sat, 6 Mar 2010 14:10:01 -0800, PeterM
wrote:

Does anyone know of a way to search thru AC2003 queries to find a text
string? For example, I need to find all queries that contain the text
"Forms".

Thanks for your help!


There might be a way to use the systems tables, but I wasn't able to figure it
out. Try:


Public Sub SearchQueries()
Dim q As QueryDef
For Each q In CurrentDb.QueryDefs
If InStr(q.SQL, "Forms") 0 Then
Debug.Print q.Name, q.SQL
End If
Next q
End Sub
--

John W. Vinson [MVP]
  #3  
Old March 7th, 2010, 01:50 AM posted to microsoft.public.access
AG[_3_]
external usenet poster
 
Posts: 129
Default Find Text in a Query

http://www.rickworld.com/products.html

--

AG
Email: npATadhdataDOTcom


"PeterM" wrote in message
...
Does anyone know of a way to search thru AC2003 queries to find a text
string? For example, I need to find all queries that contain the text
"Forms".

Thanks for your help!




  #4  
Old March 7th, 2010, 02:42 AM posted to microsoft.public.access
Rob Parker[_3_]
external usenet poster
 
Posts: 173
Default Find Text in a Query

This seems to work:
SELECT MSysObjects.Name, MSysQueries.Expression
FROM MSysObjects INNER JOIN MSysQueries ON MSysObjects.Id =
MSysQueries.ObjectId
WHERE (((MSysQueries.Expression) Like "*forms*") AND
((MSysObjects.Type)=5));

It will return "internal" queries (recordsources for forms, combo-boxes,
etc, which have a SQL statement); if you want to exclude those, use this:
SELECT MSysObjects.Name, MSysQueries.Expression
FROM MSysObjects INNER JOIN MSysQueries ON MSysObjects.Id =
MSysQueries.ObjectId
WHERE (((MSysObjects.Name) Not Like "~*") AND ((MSysQueries.Expression) Like
"*forms*") AND ((MSysObjects.Type)=5));

HTH,

Rob


PeterM wrote:
Does anyone know of a way to search thru AC2003 queries to find a text
string? For example, I need to find all queries that contain the text
"Forms".

Thanks for your help!



  #5  
Old March 7th, 2010, 06:00 PM posted to microsoft.public.access
PeterM
external usenet poster
 
Posts: 208
Default Find Text in a Query

John, AC and Rob... thanks for your answers, works like a champ!

PeterM

"Rob Parker" wrote:

This seems to work:
SELECT MSysObjects.Name, MSysQueries.Expression
FROM MSysObjects INNER JOIN MSysQueries ON MSysObjects.Id =
MSysQueries.ObjectId
WHERE (((MSysQueries.Expression) Like "*forms*") AND
((MSysObjects.Type)=5));

It will return "internal" queries (recordsources for forms, combo-boxes,
etc, which have a SQL statement); if you want to exclude those, use this:
SELECT MSysObjects.Name, MSysQueries.Expression
FROM MSysObjects INNER JOIN MSysQueries ON MSysObjects.Id =
MSysQueries.ObjectId
WHERE (((MSysObjects.Name) Not Like "~*") AND ((MSysQueries.Expression) Like
"*forms*") AND ((MSysObjects.Type)=5));

HTH,

Rob


PeterM wrote:
Does anyone know of a way to search thru AC2003 queries to find a text
string? For example, I need to find all queries that contain the text
"Forms".

Thanks for your help!



.

  #6  
Old March 17th, 2010, 01:37 PM posted to microsoft.public.access
joelgeraldine
external usenet poster
 
Posts: 201
Default Find Text in a Query

kl,,,,,,cccc

"PeterM" a écrit dans le message de
groupe de discussion : ...
Does anyone know of a way to search thru AC2003 queries to find a text
string? For example, I need to find all queries that contain the text
"Forms".

Thanks for your help!


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:25 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.