我的Access數據庫鏈接到我的SQL Server 2008. 我試圖驗證如果輸入到文本框字段(稱爲diverNo)的值是一個數字(只允許在該字段中的數字)。我希望它儘快在用戶離開現場驗證,如果用戶試圖將它不是一個數字的任何字符,現場將被清理:訪問2013年的運行時錯誤2115
Private Sub Form_Error(DataErr As Integer, Response As Integer)
If DataErr = 2113 Then
Response = acDataErrContinue
MsgBox ("Only numbers are allowed in Diver Number")
Me.diverNo = "" ' <- this line cause the error
Exit Sub
End If
End Sub
我得到運行時錯誤2115這狀態「設置爲該字段的BeforeUpdate或ValidationRule屬性的宏或函數阻止Microsoft Office Access將該數據保存在該字段中。」
任何建議來解決這個問題?
在'BeforeUpdate'方法中,值不能被改變。 – 2014-10-17 14:43:31