Microsoft KB Archive/193167

= ACC97: Error When You Click a Custom Command Bar Button =

Article ID: 193167

Article Last Modified on 1/23/2007

-

APPLIES TO


 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q193167



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



SYMPTOMS
When you click a menu or button on a command bar, you may see the following error message:

The expression you entered has a field, control or property name that Microsoft Access can't find.



CAUSE
This problem happens when the database has a long file name, and you assign a function using the following syntax:   .OnAction = "= "



RESOLUTION
Do not include an equal sign (=) and parentheses () when you assign the function to the OnAction property of the command bar. For example, assign the OnAction property using the following syntax:   .OnAction = " "



STATUS
Microsoft has confirmed this to be a problem in Microsoft Access 97.



Steps to Reproduce Problem
 Create a new database named Db1.mdb. Insert a new module, and then create a reference to Microsoft Office 8.0 Object Library.  Type the following line in the Declarations section if it is not already there:      Option Explicit </li>  Type the following procedures: Sub Test

Dim MBar As CommandBar Dim MBarItem As CommandBarControl

Set MBar = CommandBars.Add(Name:="Test Bar") MBar.Visible = True Set MBarItem = MBar.Controls.Add(Type:=msoControlButton) With MBarItem .Caption = "Test" .Style = msoButtonCaption .OnAction = "=RunMe" End With

End Sub

Function RunMe MsgBox "You pressed a toolbar button!" End Function </li> On the File menu, click Save. Type Module1 in the Save As dialog box, and then click OK.</li> To test this function, type the following line in the Debug window, and then press ENTER:

Test

A new menu bar should appear.</li> On the Test menu bar, click Test. You should get a message box that reads "You pressed a toolbar button!" Click OK.</li> On the File menu, click Exit.</li> Open Windows Explorer and change the name of the file to This is a long file name.mdb .</li> Open the "This is a long file name.mdb" file.</li> On the Test menu bar, click Test. You should receive the error message mentioned in the "Symptoms" section.</li></ol>

Additional query words: the expression you entered has a field control or property name that Microsoft Access can t find

Keywords: kbbug kberrmsg kbpending KB193167

-

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

© Microsoft Corporation. All rights reserved.