ACC: Cannot Use Code to Set the LogMessages Property (118367)
The information in this article applies to:
- Microsoft Access 2.0
- Microsoft Access for Windows 95 7.0
- Microsoft Access 97
This article was previously published under Q118367 SYMPTOMS
Advanced: Requires expert coding, interoperability, and multiuser skills.
When you create an SQL pass-through query in a Visual Basic for
Applications procedure, you may receive the following error message when
you try to set the LogMessages property of the QueryDef object.
In Microsoft Access 7.0 or 97:
Method or data member not found
In Microsoft Access version 2.0:
Name not found in this collection
This article assumes that you are familiar with Visual Basic for
Applications and with creating Microsoft Access applications using the
programming tools provided with Microsoft Access. For more information
about Visual Basic for Applications, please refer to your version of the
"Building Applications with Microsoft Access" manual.
NOTE: Visual Basic for Applications is called Access Basic in Microsoft
Access version 2.0. For more information about Access Basic, please refer
to the "Building Applications" manual.
CAUSE
LogMessages is an extended property that cannot be addressed directly as a
property of the QueryDef object because an extended property does not
exist within the QueryDefs collection. You can use the property sheet of a
query to set the LogMessages property setting, or you can use the
CreateProperty function in code to append the LogMessages property to the
query object. Then you can set the property in your procedure.
RESOLUTION
Because the LogMessages property is an extended property, it must be
defined, and then appended to the QueryDef object before you can set the
value of the property. For example, given a QueryDef object dimensioned
as MyQD, you need to add the following code to your Visual Basic for
Applications procedure before you set the LogMessages property:
Dim MyProp as Property
...
Set MyProp = MyQD.CreateProperty("LogMessages", DB_BOOLEAN, True)
MyQD.Properties.Append MyProp
After MyProp is appended to the Properties collection of MyQD, use the
following syntax when you reference the LogMessages property:
MyQD.Properties("LogMessages") = True
Modification Type: | Minor | Last Reviewed: | 10/11/2006 |
---|
Keywords: | kberrmsg kbprb kbProgramming kbusage KB118367 |
---|
|