Skip to content
Advertisement

Trying to trouble Object required error in VBA

I got this problem. I have a form that retrieves a table data using the forms’ record source property. When the form’s opened, I set its record source property to a module’s public method RetrieveMembers. Here’s the code below.

Object required error is thrown.

I couldn’t comprehend this compile error. I see no wrong with my code since recordsource is a String type property. And my module’s function Retrievemembers is returning a String value.

Why is it that it’s not satisfied with this?

Advertisement

Answer

Thanks for your help.

I fixed it. The reason was because String is not really an Object to begin with. So the ‘Set’ keyword is not needed – since you don’t need to explicitly declare String-type objects anyway!

All good now!

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement