我有一个函数,我想根据字符串参数返回不同的列表框。这是功能:
Here is the function:
Private Function returnList(name As String) As AccessObject
If name = "app" Then
returnList = Me.Controls("List61")
'I have also tried the following:
'returnList = Me.List61, returnList = Forms![Daily Reports]![List61]
ElseIf name = "lpar" Then
'..several more cases
End If
End Function
每当我尝试调用它时,都会收到“运行时错误'91':对象变量或未设置块变量”。当我使用调试器时,它告诉我对 list61(Me.list61, Me.Controls("List61")) 的引用为空。
有人知道如何解决这个问题吗?任何帮助我都会非常感激。