Accessing Query Description thru VBA

  • Thread starter Thread starter wphx
  • Start date Start date
W

wphx

Hi,

I'm working on a procedure to 'package' a query to export it to a file,
email it and allow the peson on the other end to import it.

I want to be able to package the query description as well - and to write it
on the other end - but for the life of me, I don't see how I can read/write
the description (in the properties) of the query - can anyone put me on the
right track?

TIA
 
If the query has a description, you can get at it like this:
CurrentDb.QueryDefs("MyQuery").Properties("Description")

If there is no description, this *should* yield error 3270 (i.e. Property
Not Found), and you would need to CreateProperty() if you wanted it to have
one.

However, Access can wrongly report the Description of a *Table* in the query
if the query does not have a Description of its own.

Here's an example of some code that sets a property, creating it if
necessary. Scroll down to SetPropertyDao():
http://allenbrowne.com/AppPrintMgtCode.html#SetPropertyDAO
 
Magic - works perfectly. I saw this referred to, but it was confusing that
the description property is listed on the property sheet, but doesn't exist
until details are entered. I couldn't find any clear explanation.
appreciated.

Thanks
 
Back
Top