![](/img/trans.png)
[英]Microsoft Access VBA - Locking a field when value in the field is not null
[英]Access and VBA - default value of field is null?
我正在使用Microsoft Access制作表單,並且正在嘗試為字段創建AfterUpdate
事件過程。 我需要知道該字段的值是否為默認值(或者是否為empy)。 我讀到VBA中字段的默認值為Null
所以我這樣做了:
Private Sub EB1_10_Val1_AfterUpdate()
If Me.EB1_10_Val1.Value = Null Then
MsgBox "hello"
End If
End Sub
這沒有用,因此當用戶更新字段中的值然后將其刪除(清空字段)時,我嘗試了此操作
Private Sub EB1_10_Val1_AfterUpdate()
If Me.EB1_10_Val1.Value = Empty Then
MsgBox "hello"
End If
End Sub
消息永遠不會彈出。 另一方面,我嘗試將字段的默認值更改為0,但是它不起作用。 在“表單視圖”中,默認情況下,該字段中不顯示0。
您可以使用以下表達式檢查字段是否為空:
If IsNull(Me.EB1_10_Val1.Value) Then
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.