如何使用两个主键 link 从 Access 中的子表单

How to link a sub form to a from in Access using two primary keys

在访问中,我试图制作一个导航子表单。但是,我当前的代码仅适用于一个主键。有谁知道当主键由两个字段组成时如何更改代码以使其工作?

我目前的代码如下;

Dim rs As DAO.Recordset

Set rs = Me.Parent.RecordsetClone

rs.FindFirst "[Fist Primary key]= " & Me![first primary key].Value & ""

If rs.NoMatch = False Then
    Me.Parent.Bookmark = rs.Bookmark
End If

Set rs = Nothing

只需使用 AND 语句

Dim rs As DAO.Recordset

Set rs = Me.Parent.RecordsetClone

rs.FindFirst "[Fist Primary key]= " & Me![first primary key].Value & " AND [Second Primary key]= " & Me![second primary key].Value

If rs.NoMatch = False Then
    Me.Parent.Bookmark = rs.Bookmark
End If

Set rs = Nothing