转到拆分表格上的记录

时间:2019-05-09 14:48:25

标签: vba ms-access

我正在尝试查询重新查询表单后刚刚附加在拆分表单上的记录。以下代码不会产生错误,但也不会转到新记录。所有参数均正确。有什么想法吗?

Forms!frmAddNewComponent.Requery
FindRecord Forms!frmAddNewComponent, Forms!frmAddNewComponent!txtID.Value, "ID"


Public Sub FindRecord(Component As Form, PK As Long, PKField As String)

    With Component.RecordsetClone
        .FindFirst PKField & "=" & PK
        If .NoMatch Then
            MsgBox "Record not found!", vbCritical
        Else
            Component.Bookmark = .Bookmark
        End If
    End With

End Sub

0 个答案:

没有答案