0

在访问 ADP 中的表单上,有一个未绑定的组合框,显示公司列表(显示名称,id 是绑定字段)。选择公司后,我想在该公司的子表单(其数据源是 companySubscription 视图)中显示订阅信息。我将子表单的链接主字段和链接子字段属性设置为 companyId。基本上,我是这样设置的。

理论上,我认为这意味着当我更改组合框中的值时,子表单应该显示该公司的订阅信息。但它不起作用 - 无论组合框设置为什么,子表单始终显示 companySubscription 视图中的所有数据。

帮助!

4

1 回答 1

0

找到了答案 - 有一些来自另一个项目的代码有帮助:

Private Sub cmbSub_AfterUpdate()
    ' Find the record that matches the control.
    Dim rs As Object

    Set rs = Me.Recordset.Clone
    rs.FindFirst "[subID] = " & str(Nz(Me![cmbSub], 0))
    If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

并且不得不为 ADP 修改它(感谢这篇文章!)

Private Sub ChooseCo_AfterUpdate()
    ' Find the record that matches the control.
    Dim rs As ADODB.Recordset

    Set rs = Me.Recordset.Clone
    rs.Find "[companyId] = " & Str(Nz(Me![ChooseCo], 0))
    If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
于 2010-09-21T16:57:35.730 回答