嵌入式宏错误2950 [英] Embedded macro error 2950
问题描述
Access 2007
我使用列表框向导创建了一个列表框,希望它根据我在列表框中的选择"在我的表单上找到一个值"。 最初它工作正常,直到我关闭数据库并重新打开它。 然后我得到包含宏文本的错误:
Access 2007
I made a list box using the list box wizard wanting it to "find a value on my form based on the selection I make in the listbox". Initially it works fine until I close the db and reopen it. Then I get the error which includes the macro text:
=" [Acct] =" &安培; Str(Nz([Screen]。[ActiveControl],0))
错误代码2950。
在以前版本的Access中,此函数不会创建任何嵌入式宏,而是编写一些没有此问题的事件过程代码。 以下是Access用于编写的代码,我将其放入此列表框
的新过程中以使其正常运行。
In previous versions of Access this function would not make any embedded macro but instead would write some event procedure code that did not have this problem. Here is the code that Access used to write which I put into a new procedure for this listbox to make it functiion properly.
私有子列表109_AfterUpdate()
'查找与控件匹配的记录。来自新闻组助手。
' Find the record that matches the control. From newsgroup helper.
;     
使用Me.List109
With Me.List109
       
如果不是IsNull(.Value)那么
If Not IsNull(.Value) Then
Me.Recordset.FindFirst" [Acct] =" &安培; .Value
Me.Recordset.FindFirst "[Acct] = " & .Value
;    
结束如果
End If
   
结束
End With
   
'查找与控件匹配的记录。
' Find the record that matches the control.
End Sub
我可以更改一些设置 那么事件过程将运行而不是嵌入的宏? 我确实在Access Options中进行了一次设置更改,我认为这可能会成功,在Forms / Reports"Alwayse use Event
Procedures"下但它没有帮助。
Can I change some setting so that the event procedures would run instead of the embedded macros? I did make one setting change in Access Options that I thought might do the trick, under Forms/Reports "Alwayse use Event Procedures" but it was not helpful.
推荐答案
始终使用事件程序只会在您点击时帮助您事件旁边的省略号(...)。 它不适用于向导。 奇才总是会创建嵌入式宏。 您可以通过简单地将项目放在表单/报表上并单击取消(或确保向导按钮不处于向下位置),将项目添加到项目而不是依赖
向导。
Always use Event Procedures will only help you if you click on the ellipsis (...) next to the event. It won't work with wizards. Wizards will ALWAYS create embedded macros. You can go to add your own code to items instead of relying on the wizard by simply placing the item on the form/report and clicking cancel (or by making sure that the wizard button is not in the down position).
要更改它,您可以使用转换宏到VBA和/或只需突出显示单词[嵌入式宏]并删除它们,然后选择[事件过程]并单击省略号。  但如果你选择第二个
选项,你仍然需要生成代码。
To change it you can use the Convert Macros to VBA and/or you can just highlight the words [Embedded Macro] and delete them and then select [Event Procedure] and click the ellipsis. But you will still have to generate the code if you do the second option.
这篇关于嵌入式宏错误2950的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!