INSERT INTO查询不起作用

时间:2017-06-14 18:34:57

标签: ms-access access-vba

我有两个插入查询。第一个是:

DoCmd.RunSQL "INSERT INTO tblInvoices ( InvDate, ClientFK, DiscFK, ReceiptFK ) " & _
              "SELECT tblInvoices.InvDate, tblInvoices.ClientFK, tblInvoices.DiscFK, tblInvoices.ReceiptFK " & _
              "From tblInvoices " & _
              "WHERE (((tblInvoices.InvDate)=Date()) AND ((tblInvoices.ClientFK)=[Forms]![frmDisclosure]![ClientFK]) " & _
              "AND ((tblInvoices.DiscFK)=[Forms]![frmDisclosure]![DiscPK]) AND " & _
              "((tblInvoices.ReceiptFK)=[Forms]![frmDisclosure]![ReceiptFK])) "

这不起作用,尽管重新设计使其变得简单(插入基本数据,如数字而不是链接到'frmDisclosure'。没有任何反应 - 数据表视图中没有数据显示。相反,我创建了一个表单,其中一个过程成功完成了工作。运行该过程后,以下插入查询成功运行。

DoCmd.RunSQL "INSERT INTO tblInvoiceDetails ( DiscFK, InvoiceFK ) " & _
             "SELECT tblInvoices.DiscFK, tblInvoices.InvoicePK " & _
             "From tblInvoices " & _
             "WHERE (((tblInvoices.InvoicePK)=[Forms]![frmInvoiceAdd]![InvoicePK])) "

对于'整洁',我想先得到第一个查询。

0 个答案:

没有答案