Microsoft KB Archive/225956

= ACC2000: Cannot Use New Visual Basic for Application Functions as Expressions =

Article ID: 225956

Article Last Modified on 6/23/2005

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q225956



Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).



SYMPTOMS
When you use one of the new Visual Basic for Applications functions as an expression, you may receive the #Name? error value. For example, if you set the ControlSource property of a text box to the expression =WeekdayName(6), the text box returns #Name? instead of the value Friday.



CAUSE
The FormatCurrency, FormatDateTime, FormatNumber, FormatPercent, InStrRev, MonthName, Replace, Round, StrReverse and WeekdayName functions are not supported as expressions.



RESOLUTION
Microsoft 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. Create a custom function in a module that uses the built-in Visual Basic for Applications function. Then call this function where you need the expression. For example, create the following function: Function MyStrRev(strRev) MyStrRev = StrReverse(strRev) End Function After you have created the function, set the ControlSource property of the text box to =MyStrRev("abcd").



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce Behavior
 Open the sample database Northwind.mdb. In the Database window, click Forms under Objects, and then click New. In the New Form dialog box, click Design View, and then click OK. Add a text box to the form, and set the ControlSource property of the text box as follows:

=WeekdayName(6)

 On the View menu, click Form View.

Note that the text box returns the #Name? error value.</li></ol>

Additional query words: pra vba

Keywords: kberrmsg kbbug kbpending KB225956

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.