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

In which database is my query?

Situation: a directory full of .mdb files. Need to find a routine
that generates a list of all the queries in each .mdb.

Anybody know of such a beast?

Aug 14 '07 #1
2 1378
This actually creates a table of queries and descriptions (I omit Action
queries (Delete, Append & Update, but just remove the appropriate lines)

The TblQueries is
QueryID Auto
QueryName Text
QueryVersion Long ' You dont need this
QueryDescription Text
ParameterUsed Yes.No ' You dont need this either
Function PopulateTblQueries(Version As Long) ' Populate TblQueries
with all queries

Dim Mydb As Database
Dim QuerySet As Recordset, ParamSet As Recordset
Dim i As Integer
Dim QueryName As String, SQLStg As String, Criteria As String
Dim ParamUsed As Boolean

Set Mydb = CurrentDb

SQLStg = "SELECT TblQueries.* FROM TBLQueries"
Set QuerySet = Mydb.OpenRecordset(SQLStg)

On Error GoTo PopulateTblQueries_Err

For i = 0 To Mydb.QueryDefs.Count - 1
If Left(Mydb.QueryDefs(i).Name, 4) <"~sq_" _
And Left(Mydb.QueryDefs(i).Name, 6) <"Append" _
And Left(Mydb.QueryDefs(i).Name, 6) <"Delete" _
And Left(Mydb.QueryDefs(i).Name, 6) <"Update" Then
QueryName = Mydb.QueryDefs(i).Name
Criteria = "QueryName = '" & QueryName & "'"

SQLStg = "SELECT DISTINCT TblQueries.* "
SQLStg = SQLStg & "FROM TblQueries INNER JOIN TblParameters "
SQLStg = SQLStg & "ON TblQueries.QueryID = TblParameters.QueryID "
SQLStg = SQLStg & "WHERE TblQueries.QueryName = '" & QueryName &
"';"
Set ParamSet = Mydb.OpenRecordset(SQLStg)
If ParamSet.RecordCount 0 Then
ParamUsed = True
Else
ParamUsed = False
End If
ParamSet.Close
Set ParamSet = Nothing

With QuerySet
.FindFirst Criteria
If .NoMatch Then
.AddNew
Else
.Edit
End If
!QueryName = Mydb.QueryDefs(i).Name
!QueryVersion = Version
!QueryDescription =
Mydb.QueryDefs(i).Properties("Description")
If ParamUsed = True Then
!ParametersUsed = True
Else
!ParametersUsed = False
End If
.Update
End With
End If
NextQuery:
Next i

Me.Requery

Exit Function

PopulateTblQueries_Err:
If Err = 3270 Then
Resume Next ' Description property not found
Else
MsgBox Err.Description
End If

End Function

HTH

Phil
"rq******@sympatico.ca" <bo*********@gmail.comwrote in message
news:11*********************@w3g2000hsg.googlegrou ps.com...
Situation: a directory full of .mdb files. Need to find a routine
that generates a list of all the queries in each .mdb.

Anybody know of such a beast?

Aug 14 '07 #2
"Larry Linson" <bo*****@localhost.notwrote in
news:TVQwi.13216$jy5.11681@trnddc07:
It appears that you've used Phil's and Tom's suggestions and
solved the problem.

From your description of the situation, I suspect that was the
best approach.

Oh, unless it qualified you for an upgrade (and I'm not
familiar enough with FMS' pricing policies to remember, if I
ever did know) that Access 97 Total Access Analyzer wouldn't
be useful on later versions.

Larry Linson
Once I had a pointer to the opendatabase method, It wasn't hard.
MS-Access is so rich in tools that one can never know all of
them.

The benefit of this newsgroup is the ability to get information
by someone who does know what to do in a specific situation, so
collectively, we do know all of the tools.

Have a good day.
--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Aug 16 '07 #3

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

Similar topics

5
by: lkrubner | last post by:
I have a webserver through Rackspace. I create a domain. I create an FTP user. I upload some files. I create a database called testOfSetupScript and then I create a database user named setup. I...
8
by: RibGnaw | last post by:
Long, long ago when Access 97 first hit the streets a sample database called Northwind was shipped with it. At that time a number of articles had been posted on the correct procedure to remove all...
3
by: Bob Bedford | last post by:
hello I'm looking for some functions or objects allowing to select-insert-update-delete from any table in a mysql database without the need to create a new query every time. Example: ...
3
by: josh.kuo | last post by:
Sorry about the subject, I can't think of a better one. I recently wrote some PHP classes that I think might be of interest to this group. Since I have been reaping the benefits of reading news...
2
by: azmiza | last post by:
Hi everybody, I need your help. I want to view my sql database and its work very well which is display in my web browser but once I want to press button yes, its not working, I check the...
10
by: eholz1 | last post by:
Hello Members, I am setting up a photo website. I have decided to use PHP and MySQL. I can load jpeg files into the table (medium blob, or even longtext) and get the image(s) to display without...
2
by: basestring | last post by:
Hi I am busy now for many hours without luck I have a database and when I use PHP to add date to it, it works only one time when i want to add the next data, It doesn't work. but i don't get any...
15
by: harvey | last post by:
How do I make PHP create a database for mysql please? I can see how to make tables and I have read all the documents I can find but I don't understand how to make the database itself. All...
221
Atli
by: Atli | last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t. In situations where your PHP application...
39
by: alex | last post by:
I've converted a latin1 database I have to utf8. The process has been: # mysqldump -u root -p --default-character-set=latin1 -c --insert-ignore --skip-set-charset mydb mydb.sql # iconv -f...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
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...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.