简体   繁体   English

限定符必须是集合

[英]Qualifier must be collection

I am up against an MS-Access compile error I've never seen before: "Qualifier must be collection".我遇到了以前从未见过的 MS-Access 编译错误:“Qualifier must be collection”。 Can't seem to get around it making simple syntax changes.似乎无法绕过它进行简单的语法更改。 Nothing truly relevant turns up on web. Here is the offending line of code in the OnOpen event of a report: web 上没有真正相关的内容。这是报告的 OnOpen 事件中有问题的代码行:

Me.Filter = Forms.fmod_Notes.cboFilter. Me.Filter = Forms.fmod_Notes.cboFilter。

Highlighted: ".fmod_Notes".突出显示:“.fmod_Notes”。 The calling form is open.调用表单已打开。 Why isn't it considered a member object of the Forms collection..?.为什么它不被视为 Forms 集合的成员 object...? Thoughts..??思想..?

Thanks!谢谢!

See Details, above...请参阅上面的详细信息...

It sounds like the issue may be with the naming of the form or the way it is being referenced.听起来问题可能出在表单的命名或引用方式上。 Here are a few things to check:以下是一些需要检查的事项:

Verify that the form "fmod_Notes" is spelled correctly in the code and that it exists in the project.验证表单“fmod_Notes”在代码中的拼写是否正确以及它是否存在于项目中。

Make sure that the form "fmod_Notes" is open before the report is opened.确保在打开报表之前打开“fmod_Notes”表单。 If it is not open, the Forms collection will not include it.如果不开放,Forms 收藏不会收录。

Check the scope of the form "fmod_Notes".检查表格“fmod_Notes”的 scope。 If it is declared as a private form, it may not be accessible to the report.如果将其声明为私有表单,则报表可能无法访问它。

Try using the full reference to the form instead of just the name, for example: Forms("fmod_Notes").cboFilter尝试使用对表单的完整引用而不仅仅是名称,例如:Forms("fmod_Notes").cboFilter

If none of the above solutions work, it may be worth checking if the form is loaded properly when the report is opened, you can use the VBA command "Forms.Count" to check the number of forms loaded in your project and see if the form you are trying to reference is listed.如果以上解决方案都不起作用,可能值得检查打开报表时是否正确加载了表单,您可以使用 VBA 命令“Forms.Count”检查项目中加载的 forms 的数量,看看是否列出了您尝试引用的表格。

Make sure that the form "fmod_Notes" is not open as a pop-up form, as pop-up forms are not considered a member object of the Forms collection.确保表单“fmod_Notes”未作为弹出表单打开,因为弹出窗口 forms 不被视为 Forms 集合的成员 object。 If none of these suggestions help, please provide more information about your project and its setup.如果这些建议都没有帮助,请提供有关您的项目及其设置的更多信息。 This will make it easier for others to understand your problem and help you find the solution.这将使其他人更容易理解您的问题并帮助您找到解决方案。

declare variable Dim strFilter as String.将变量 Dim strFilter 声明为 String。 strFilter = Forms.fmod_Notes.cboFilter Make "Debug.Print strFilter" to check the String. strFilter = Forms.fmod_Notes.cboFilter 制作“Debug.Print strFilter”以检查字符串。 If the BoundColumn of your comboBox is the eg the PrimaryKey you have to use cboFilter.column(x) to get the right string.如果您的 comboBox 的 BoundColumn 是例如 PrimaryKey,您必须使用 cboFilter.column(x) 来获取正确的字符串。

If the String is ok make Me.Filter = strFilter如果字符串没问题,使 Me.Filter = strFilter

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM