Article ID: 143453 - Last Review: October 11, 2006 - Revision: 2.3 Named Arguments Are Not Supported with DAOThis article was previously published under Q143453 On This PageSYMPTOMS
When you run a Microsoft Excel Visual Basic for Applications macro that
uses Data Access Objects (DAO), you may receive one of the following error
messages:
Compile Error: Named Argument Not Found
-or-
Run-time error '438': Object doesn't support this property or method CAUSE
DAO versions 3.0 and 3.5, which are included with Microsoft Excel 7.0 and
97 respectively, do not fully support named arguments. In some cases, named
arguments will work without error, however, you should avoid using them.
This behavior is by design of Microsoft Excel. RESOLUTIONMicrosoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
To work around this behavior, use positional arguments instead of named
arguments.
In a Visual Basic macro, when you call a Subroutine or Function, you can supply arguments positionally, in the order in which they appear in the definition of the procedure. Alternatively, you can supply the arguments by name without regard to position. However, with DAO properties and methods, Microsoft recommends that you use only positional arguments. Example of the ProblemThe DAO 3.5 OpenDatabase method uses the following syntax:Example of the ResolutionTo correct the problem, use positional arguments. To do this, supply the arguments for the method in the correct position, where each argument is delimited by a comma, as shown in the following example:REFERENCES
For more information about named arguments, click the Index tab in
Visual Basic for Applications Help, type the following text
named arguments
click the Display button, and then double-click the "Understanding Named
Arguments and Optional Arguments" topic.
| Article Translations
|

Back to the top
