【问题标题】:Access 2007 / VBA - Multiple Instances of Form, Update controls on specific instance from ModuleAccess 2007 / VBA - 多个表单实例,从模块更新特定实例的控件
【发布时间】:2016-10-09 05:20:36
【问题描述】:

我正在使用 Allen Browne 的方法来创建和管理表单的多个实例。我被困在如何从 VBA 模块引用表单的特定实例上的控件或属性。以下是我打开新实例的方法:

'Purpose:    Open an independent instance of form frmMasterRecord.
Dim frm As Form

'Housekeeping
myFilter = Trim("" & myFilter)

'Open a new instance, show it, and set a caption.
Set frm = New Form_frmMasterRecord
frm.ServerFilter = myFilter
frm.ServerFilterByForm = True
frm.Requery
frm.Visible = True

'Append it to our collection.
clnMasterRecord.Add Item:=frm, Key:=CStr(frm.hwnd)

Set frm = Nothing

假设我打开了三个 frmMasterRecord 实例。如何在模块中调用子/函数并让它仅在表单的调用实例上操作控件?

【问题讨论】:

  • 你试过的代码是什么?

标签: vba forms ms-access controls instance


【解决方案1】:

传递对调用表单的引用:

Result = MyExternalFunction(Me)

Public Function MyExternalFunction(ByRef frm As Form) As Boolean

    ' Do stuff with object frm.

    MyExternalFunction = Result

End Function

【讨论】:

    猜你喜欢
    • 2017-06-24
    • 1970-01-01
    • 2021-09-14
    • 2019-06-06
    • 2012-11-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多