-1

我有一个与查询相关的掩码。

此掩码显示访问表中的记录(一次一条记录),例如 A 表。

当用户点击一个按钮时,记录被复制到另一个表中,比如 B,它必须从原始表 (A) 中删除。此外,如果有的话,掩码必须传递到下一个或上一个记录。

表 B 不能有键字段。

我如何通过 vba 实现这一目标?

4

1 回答 1

0

Have your button copy, and then delete the record being displayed on the form on your button press.

Sub btnCopy()
    Dim strSQL as string
    strSQL = "INSERT INTO TableB SELECT fld1, fld2 FROM TableA WHERE fld1 = '" & txtFld1 & "'"
    CurrentDb.Execute strSQL
    strSQL = "DELETE FROM TableA WHERE fld1 = '" & txtFld1 & "'"
    CurrentDb.Execute strSQL
End Sub
于 2012-09-13T13:17:35.713 回答