我试图从我的其他窗体'frmDisclosure'的窗体'frmInvoiceAdd'中运行一个过程。这不是Form/SubForm关系。他们是分开的。在 'frmInvoiceAdd' 的程序是:以另一种形式运行程序
CmdInvoice on click:
Public Sub CmdInvoice_Click()
On Error GoTo CmdInvoice_Click_Err
On Error Resume Next
DoCmd.GoToRecord , "", acNewRec
DoCmd.GoToControl "InvDate"
Me.InvDate = Date
DoCmd.RunCommand acCmdSaveRecord
DoCmd.RunSQL "UPDATE tblInvoices SET tblInvoices.DiscFK = [Forms]!
[frmDisclosure]![DiscPK], " & _
"tblInvoices.ClientFK = [Forms]![frmDisclosure]![ClientFK],
tblInvoices.ReceiptFK = [Forms]![frmDisclosure]![ReceiptFK] " & _
"WHERE (((tblInvoices.InvoicePK)=[Forms]![frmInvoiceAdd]!
[InvoicePK])) "
CmdInvoice_Click_Exit:
Exit Sub
CmdInvoice_Click_Err:
MsgBox Error$
Resume CmdInvoice_Click_Exit
End Sub
我想从 'frmDisclosure' 这条命令:
DoCmd.OpenForm "frmInvoiceAdd"
Run Forms!frmInvoiceAdd.CmdInvoice_Click
DoCmd.Close acForm, "frmInvoiceAdd"
我收到此错误信息:
Microsoft Access不能找到程序'。' 它强调: 运行形式frmInvoiceAdd.CmdInvoice_Click
我试图改变“运行”,以电话,但我收到此错误信息: !预计:。或(
但是,这是否实际运行过程'呼叫Form_frmInvoiceAdd.CmdInvoice_Click()'应该工作 – Andre
是的,它运行了程序,但我不满意使用On Error Resume Next。我删除了后者,并使用你的建议,它的工作。谢谢。 –