Microsoft KB Archive/205673

= BUG: Access 97 Generates Invalid Code for OLE_COLOR in Event Handler =

Article ID: 205673

Article Last Modified on 2/12/2007

-

APPLIES TO


 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q205673



SYMPTOMS
When handling an event for an ActiveX control in an Access 97 form, you may run into problems if any of the events use OLE_COLOR for a parameter. Specifically, you may get a message that states the following:

The expression "somename" you entered as the event property setting produced the following error: Function or interface marked as restricted or the function uses an automation type not supported in Visual Basic


 * The expression may not result in the name of a macro, the name of a user defined function, or [Event Procedure].


 * There may have been an error evaluating the function, event, or macro.



CAUSE
This is due to a limitation in the Access 97 product.



RESOLUTION
If you have the source code for the control, you need to change the parameter that is using OLE_COLOR to a different type like a long. Otherwise, you will not be able to catch the event of the control in Access 97.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.



Steps to Reproduce Behavior

 * 1) Insert a control into an Access 97 form that has an event with an OLE_COLOR parameter.
 * 2) Double-click the control on the form in design view.
 * 3) Change to the event that uses the OLE_COLOR.

You will notice that the event handler has the incorrect parameter type. Access 97 generates code that looks something like this: Private Sub ActiveXCtl0_Test(testparam As 0) End Sub

Additional query words: kbDSupport Access97Bug MFC Control Container Limitations

Keywords: kbbug kbnofix kbautomation KB205673

-

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

© Microsoft Corporation. All rights reserved.