Search on Description?? (1 Viewer)

gmatriix

Registered User.
Local time
Today, 02:12
Joined
Mar 19, 2007
Messages
365
Hey Guys,

Weird question,

Is there a way to search on the description of a queries?

Say if I want to make some notes about the query I built because I might need to use it later....or remember how I did it...

Any way? or Naa?
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:12
Joined
Oct 29, 2018
Messages
21,454
Hi. There's got to be a way, somehow. I imagine it might involve using VBA and a QueryDef object. You can then loop through the properties for each query and examine the content of the Description property.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 07:12
Joined
Sep 12, 2006
Messages
15,634
the description is a custom property of the query, that only gets created when you add a description.

You can read it with DAO, and it might be stored in a system table. You could possibly store a table of the queries, and keep notes in there (if it's not in a system table). It's not ideal.

currentdb.querydefs("queryname").description
currentdb.tabledefs("tablename").description

that sort of thing.


----
edit - I thought I would check, and it isn't that - so I am looking more closely now.

right, I was sort of correct, and it's curious.
It is a custom property, but you can't use the above syntax.
You can use this syntax.
You get error 3265, not in collection if the "description" hasn't been created.

{I previously said it takes a few seconds to display - what appears to be taking time is initialising the querydef object}

currentdb.querydefs("queryname").properties("description")
currentdb.tabledefs("tablename").properties("description")
 
Last edited:

gmatriix

Registered User.
Local time
Today, 02:12
Joined
Mar 19, 2007
Messages
365
Yeah...you are right....

I wish I had time to figure it out...:confused:

I think I will just make a copy of the query and name it something that can be searched.....

double the queries....double the fun ;)

Thanks
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 07:12
Joined
Sep 12, 2006
Messages
15,634
does this help?

Code:
Sub showproperties()
Dim prp As Property
Dim db As Database
Dim qdf As QueryDef


Set db = CurrentDb
Set qdf = db.QueryDefs("qryName")

    For Each prp In qdf.Properties
    On Error GoTo fail
    MsgBox prp.Name & "  " & prp.value
nextprop:
    Next
Exit Sub

fail:
    MsgBox "no value for property: " & prp.Name
    Resume nextprop
End Sub
 

Users who are viewing this thread

Top Bottom