【发布时间】:2016-10-04 03:22:12
【问题描述】:
我正在使用 MS Access 2007 和 VBA。我有一个代码块,当数量大于库存或库存为零时触发。
Private Sub Quantity_BeforeUpdate(Cancel As Integer)
If Me.Quantity > Me.Stock Or Me.Stock = 0 Then
MsgBox "Not enough stocks left."
Me.Quantity = ""
End If
End Sub
消息框出现,但随后出现错误消息:
Run-time error '2147352567 (80020009)':
The macro or function set to BeforeUpdate or ValidationRule property for this field is preventing Microsoft Office Access from saving the data in the field.
如何停止这个错误?
【问题讨论】: