测试场留空的更好方法 [英] Better way to test for field being left empty

查看:57
本文介绍了测试场留空的更好方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用它来测试用户是否将文本字段留空:


如果Me.txtProductID =""或IsNull(Me.txtProductID)= True然后

在这里做点什么

结束如果


是否有更好的方法来确定如果用户将字段留空了?


谢谢,

TD

解决方案

2005年11月10日07:32:46 -0800,TD < DL ** @ adsi-sc.com>写道:

我用它来测试用户是否将文本字段留空:

如果Me.txtProductID =""或IsNull(Me.txtProductID)= True然后
在这里做点什么
结束如果

有没有更好的方法来确定用户是否已将字段留空?

谢谢,
TD




我用 -

如果Len(Me.txtProductID& vbNullString)= 0然后''空字段


TD写道:

我用它来测试用户是否将文本字段留空:

如果Me.txtProductID =""或IsNull(Me.txtProductID)= True然后
在这里做点什么
结束如果


将空白字符串插入文本框中的步骤是什么? br />
表格?

有没有更好的方法来确定用户是否已将字段留空?


您可以检查名称以txt开头的所有控件。在一个

循环中。也许在文本框的Tag属性中设置一个值,这些文本框需要数据才能获得。

谢谢,
TD




James A. Fortune


" TD" < DL ** @ adsi-sc.com>在消息中写道

news:11 ********************** @ o13g2000cwo.googlegr oups.com ...

我用它来测试用户是否将文本字段留空:

如果Me.txtProductID =""或IsNull(Me.txtProductID)= True然后
在这里做点什么
结束如果

有没有更好的方法来确定用户是否已将字段留空?



当你测试

nulls和零长度字符串时,你有什么带'n''括号方法。我唯一的微小变化是


....或IsNull(Me.txt)那么


但是''只是个人喜好。


基思。
www .keithwilby.com


I use this to test if a user has left a text field empty:

If Me.txtProductID = "" Or IsNull(Me.txtProductID) = True Then
do something here
End If

Is there a better way to determine if a user has left a field empty?

Thanks,
TD

解决方案

On 10 Nov 2005 07:32:46 -0800, "TD" <dl**@adsi-sc.com> wrote:

I use this to test if a user has left a text field empty:

If Me.txtProductID = "" Or IsNull(Me.txtProductID) = True Then
do something here
End If

Is there a better way to determine if a user has left a field empty?

Thanks,
TD



I use -
If Len(Me.txtProductID & vbNullString)=0 Then ''empty field


TD wrote:

I use this to test if a user has left a text field empty:

If Me.txtProductID = "" Or IsNull(Me.txtProductID) = True Then
do something here
End If
What is the procedure for inserting a blank string into a textbox on a
form?
Is there a better way to determine if a user has left a field empty?
You can check all the controls with names beginning with "txt" in one
loop. Maybe put a value in the Tag Property of textboxes that are
required to have data.

Thanks,
TD



James A. Fortune


"TD" <dl**@adsi-sc.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...

I use this to test if a user has left a text field empty:

If Me.txtProductID = "" Or IsNull(Me.txtProductID) = True Then
do something here
End If

Is there a better way to determine if a user has left a field empty?



What you have there is a belt ''n'' braces approach as you''re testing for both
nulls and for zero-length strings. The only slight change I''d make is

.... Or IsNull(Me.txt) Then

but that''s just personal preference.

Keith.
www.keithwilby.com


这篇关于测试场留空的更好方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆