IsNull runTime:无效使用Null [英] IsNull runTime: Invalid Use of Null
问题描述
如果确定存在
伤害或土壤,我正在尝试确定是否已输入详细信息字段中的信息
(damagedetails; soildetails) (复选框:chkDamage和
chkSoil)。
这是我在表格的关闭事件上的代码(不知道是否有'' sa $ / b $ b更好的地方吗?)
私人子cmdClose_Click()
错误GoTo Err_cmdClose_Click
Dim chkDamage As String
Dim chkSoil As String
Dim txtDamageDetails As String
Dim txtSoilDetails As String
chkDamage = Me.chkDamage
chkSoil = Me.chkSoil
txtDamageDetails = Me.txtDamageDetails
txtSoilDetails = Me.txtSoilDetails
MsgBox Me.txtDamageDetails& " soil det &安培; Me.txtSoilDetails
''如果有任何变化,请确保有详细的土壤
或损坏,
''如果有的话true
如果Me.Dirty = True那么
如果chkDamage = True那么
如果Len(修剪$) (Me.txtDamageDetails& vbNullString))= 0然后
''与此代码相同的erorr:
''如果IsNull(txtDamageDetails)那么
MsgBox"请输入损坏详情"
结束如果
结束如果
如果chkSoil = True那么
如果Len(Trim $(Me.txtSoilDetails& vbNullString))= 0那么
MsgBox"请输入土壤详细信息>
结束如果
结束如果
结束如果
DoCmd.Close
谢谢。 90分钟就可以了;无法找到帖子或帮助清理它。
sara
I am trying to identify if a information in a details field
(damagedetails; soildetails) has NOT been entered if the presence of
damage or soil has been determined (check boxes: chkDamage and
chkSoil).
Here is my code on the Close Event of the form (don''t know if there''s a
better place to put it?)
Private Sub cmdClose_Click()
On Error GoTo Err_cmdClose_Click
Dim chkDamage As String
Dim chkSoil As String
Dim txtDamageDetails As String
Dim txtSoilDetails As String
chkDamage = Me.chkDamage
chkSoil = Me.chkSoil
txtDamageDetails = Me.txtDamageDetails
txtSoilDetails = Me.txtSoilDetails
MsgBox Me.txtDamageDetails & " soil det " & Me.txtSoilDetails
'' If anything has changed, make sure that there are details for soil
or damage,
'' if either is true
If Me.Dirty = True Then
If chkDamage = True Then
If Len(Trim$(Me.txtDamageDetails & vbNullString)) = 0 Then
'' Same erorr with this code:
'' If IsNull(txtDamageDetails) Then
MsgBox "Please enter Damage Details"
End If
End If
If chkSoil = True Then
If Len(Trim$(Me.txtSoilDetails & vbNullString)) = 0 Then
MsgBox "Please enter Soil Details"
End If
End If
End If
DoCmd.Close
Thanks. 90 minutes on this; can''t find posts or Help to clear it up.
sara
推荐答案
(Me.txtDamageDetails& vbNullString))= 0然后
''与此代码相同的erorr:
''如果IsNull(txtDamageDetails)那么
MsgBox请输入损坏详情
结束如果
结束如果
如果chkSoil = True则
如果Len(Trim
(Me.txtDamageDetails & vbNullString)) = 0 Then
'' Same erorr with this code:
'' If IsNull(txtDamageDetails) Then
MsgBox "Please enter Damage Details"
End If
End If
If chkSoil = True Then
If Len(Trim
(Me.txtSoilDetails& vbNullString))= 0那么
MsgBox"请输入土壤详细信息"
结束如果
结束如果
结束如果
DoCmd.Close
谢谢。 90分钟就可以了;无法找到帖子或帮助清理它。
sara
(Me.txtSoilDetails & vbNullString)) = 0 Then
MsgBox "Please enter Soil Details"
End If
End If
End If
DoCmd.Close
Thanks. 90 minutes on this; can''t find posts or Help to clear it up.
sara
你要分配文本框的值为String变量。
如果没有赋值(即:如果文本框包含Null),那就是
问题的原因:字符串变量无法保存Null值。
唯一可以保持Null的变量类型是变体。
-
Doug Steele,Microsoft Access MVP
http://I.Am/DougSteele
(请不要发电子邮件!)
" sara" < SA ******* @ yahoo.com>在消息中写道
news:11 ********************** @ g49g2000cwa.googlegr oups.com ...
You''re assigning the value of the text boxes to String variables.
If no value has been assigned (i.e.: if the text boxes contain Null), that''s
the cause of your problem: string variables cannot hold Null values. The
only variable type that can hold Null is the variant.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"sara" <sa*******@yahoo.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
我正在尝试确定如果确定存在
损坏或土壤,是否还没有输入详细信息字段中的信息
(damagedetails; soildetails)(复选框:chkDamage和
chkSoil)。
这是关于表格关闭事件的代码(不知道是否有更好的地方可以放置它?)
Private Sub cmdClose_Click()
On Error GoTo Err_cmdClose_Click
Dim chkDamage As String
Dim chkSoil As String
Dim txtDamageDetails As String
Dim txtSoilDetails As String
chkDamage = Me.chkDamage
chkSoil = Me.chkSoil
txtDamageDetails = Me.txtDamageDetails
txtSoilDetails = Me.txtSoilDetails
''如果有任何变化,请确保有详细的土壤
或损坏,
''如果是真的
如果我。 Dirty = True然后
如果chkDamage = True那么
如果Len(Trim
I am trying to identify if a information in a details field
(damagedetails; soildetails) has NOT been entered if the presence of
damage or soil has been determined (check boxes: chkDamage and
chkSoil).
Here is my code on the Close Event of the form (don''t know if there''s a
better place to put it?)
Private Sub cmdClose_Click()
On Error GoTo Err_cmdClose_Click
Dim chkDamage As String
Dim chkSoil As String
Dim txtDamageDetails As String
Dim txtSoilDetails As String
chkDamage = Me.chkDamage
chkSoil = Me.chkSoil
txtDamageDetails = Me.txtDamageDetails
txtSoilDetails = Me.txtSoilDetails
MsgBox Me.txtDamageDetails & " soil det " & Me.txtSoilDetails
'' If anything has changed, make sure that there are details for soil
or damage,
'' if either is true
If Me.Dirty = True Then
If chkDamage = True Then
If Len(Trim
这篇关于IsNull runTime:无效使用Null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!