Query description property dynamically

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi guys,

I have a issue. I have a module which I create a query and the queries
description for the database window dynamically. This works fine. However, I
had to make changes to the database so I made a copy and everything in the
whole applications runs fine except for creating the query description
property. Now the query gets created but the description doesn't... the
message is "Property not found". Nothing was changed. Anyone know why this
would happen to the copied version?

FYI, (1) new database was compiled (2) old database stills works perfect.

StrQueryDesc = FundName & " Rollup Query - Created Dynamically"
Set qdf = dbs.QueryDefs("qrySumOnAcct")
qdf.Properties("Description") = StrQueryDesc
 
MaBell said:
I have a issue. I have a module which I create a query and the queries
description for the database window dynamically. This works fine. However, I
had to make changes to the database so I made a copy and everything in the
whole applications runs fine except for creating the query description
property. Now the query gets created but the description doesn't... the
message is "Property not found". Nothing was changed. Anyone know why this
would happen to the copied version?

FYI, (1) new database was compiled (2) old database stills works perfect.

StrQueryDesc = FundName & " Rollup Query - Created Dynamically"
Set qdf = dbs.QueryDefs("qrySumOnAcct")
qdf.Properties("Description") = StrQueryDesc


The Description property is a custom property created by
Access (not Jet) when you type a description into a query's
design. Once that is done, the porperty exists and you can
change it in code.

However, if that was never done manually done, then the
property does not exists and your code can not change it.

The typical approach is to try to set the property and use
error handling to catch it when the property doesn't exist.
The error handler can then create the property and set it.
 
Marsh, is correct, but I seem to recall a weirdity with QueryDefs.

IIRC, Access can falsely report the Description of the table the query is
based on if the QueryDef has no Description but the table does.
 
Thanks. You are both correct. When I linked my BE tables to my new DB, the
descriptions were lost, once i typed them back in, the code to create the
query descriptions worked again.

Allen Browne said:
Marsh, is correct, but I seem to recall a weirdity with QueryDefs.

IIRC, Access can falsely report the Description of the table the query is
based on if the QueryDef has no Description but the table does.
 
Back
Top