Home > Blockchain >  Qualifier must be collection
Qualifier must be collection

Time:01-26

I am up against an MS-Access compile error I've never seen before: "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:

Me.Filter = Forms!fmod_Notes.cboFilter.

Highlighted: "!fmod_Notes". The calling form is open. Why isn't it considered a member object of the Forms collection...? Thoughts...?

Thanks!

See Details, above...

CodePudding user response:

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.

Make sure that the form "fmod_Notes" is open before the report is opened. If it is not open, the Forms collection will not include it.

Check the scope of the form "fmod_Notes". 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

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.

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. 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.

CodePudding user response:

declare variable Dim strFilter as String. strFilter = Forms!fmod_Notes.cboFilter Make "Debug.Print strFilter" to check the String. If the BoundColumn of your comboBox is the e.g. the PrimaryKey you have to use cboFilter.column(x) to get the right string.

If the String is ok make Me.Filter = strFilter

  • Related