更新数据表窗体(子窗体)上的选定行

时间:2018-02-23 01:32:20

标签: vba access-vba

场景:数据表形式为子窗体,主窗体上有一个命令按钮,用于更新状态为“就绪”的所选记录的状态字段。

1 个答案:

答案 0 :(得分:0)

循环子窗体的 RecordsetClone

Dim rs As DAO.Recordset
Set rs = Me!NameOfSubformControlOnMainForm.Form.RecordsetClone

While Not rs.EOF
    If <record is member of the selected records ...> Then
        rs.Edit
            rs!Status.Value = "Ready"
        rs.Update
    End If
    rs.MoveNext
Wend
rs.Close