【发布时间】:2016-01-08 12:41:48
【问题描述】:
我在表单上有一个组合框,在我对 access 数据库运行 SQL 查询后,我试图以编程方式选择组合框中的一个项目。 我使用以下代码迭代项目并设置所选项目:
'Make the appropriate location appear in the combobox
For i = 0 To cboLocations.ListCount - 1
If Me.cboLocations.Column(0, i) = locindex Then
Debug.Print "locindex: " & locindex & vbCrLf & " Me.cboLocations.Column(0, i):" & Me.cboLocations.Column(0, i)
Me.cboLocations.SetFocus
Me.cboLocations.ListIndex = i '<<< error 2115
Exit For
End If
Next i
如前所述,我不断收到错误 2115:为此字段设置为 BeforeUpdate 或 ValidationRule 属性的宏或函数阻止 Access 保存该字段中的数据。
错误消息中指示的此组合框的任何属性均未设置为任何值。所以我被困住了。请指教。
【问题讨论】:
-
解决了还是需要具体解释?
标签: ms-access vba ms-access-2010