MS Access更改事件未触发

时间:2014-02-01 12:42:26

标签: vba events ms-access

我正在运行下面的更改事件以填充标准联系信息。当我从下拉菜单中选择名称时,这很有效。但是,我经常开始输入帐户以找到正确的帐户,因为它比滚动帐户列表更快。但是,当我选中或单击到下一个字段时,它无法识别更改并且不会触发。我错过了什么?

Private Sub cboAccountID_Change()
' Adds Account info to invoice
    Invoice_To = DLookup("Invoice_To", "tblClientLists", "AccountID =" & Forms![frmInvoices]!AccountID)
    Invoice_Email = DLookup("Invoice_Email", "tblClientLists", "AccountID =" & Forms![frmInvoices]!AccountID)
    Service_Type = DLookup("Service_Type", "tblClientLists", "AccountID =" & Forms![frmInvoices]!AccountID)
    Client_Rate = DLookup("Client_Rate", "tblClientLists", "AccountID =" & Forms![frmInvoices]!AccountID)
    Address = DLookup("Address", "tblClientLists", "AccountID =" & Forms![frmInvoices]!AccountID)
    Unit_Suite = DLookup("Unit_Suite", "tblClientLists", "AccountID =" & Forms![frmInvoices]!AccountID)
    City = DLookup("City", "tblClientLists", "AccountID =" & Forms![frmInvoices]!AccountID)
    State = DLookup("State", "tblClientLists", "AccountID =" & Forms![frmInvoices]!AccountID)
    Zip = DLookup("Zip", "tblClientLists", "AccountID =" & Forms![frmInvoices]!AccountID)

1 个答案:

答案 0 :(得分:0)

我认为因为你正在打字你实际上并没有改变/提交任何东西。所以代码必须从

稍微改变一下

Forms![frmInvoices]!AccountID

Forms![frmInvoices]!AccountID.Text

(我不确定在您输入时查找将如何响应。)