访问功能 - IsNull

时间:2018-05-10 13:40:10

标签: ms-access access-vba ms-access-2010

我正在尝试创建一个函数来测试文本框是否为null。我正在努力实现这一目标,因为我的代码很多,我认为这将是一个很好的方法来清理我的代码,使其更容易阅读。

主要代码页

Private Sub Command0_Click()
Dim textbox1 As String

textbox1 = Forms![Form1].Text1
MsgBox CheckTextbox(textbox1)

End Sub

功能

Public Function CheckTextbox(textboxA As String)
If IsNull(textboxA) Then
    CheckTextbox = "Yes"
Else
    CheckTextbox = textboxA
End If
End Function

0 个答案:

没有答案
相关问题