设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 1122|回复: 7
打印 上一主题 下一主题

[模块/函数] 请教!如何能简化这个查询条件?

[复制链接]
跳转到指定楼层
1#
发表于 2009-5-2 09:47:57 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
If Not IsNull([单位名称]) Or Not IsNull([登记时间]) Or Not IsNull([地址]) Or Not IsNull([法人代表]) Or _
   Not IsNull([简并征期]) Or Not IsNull([经营范围]) Or Not IsNull([开业时间]) Or Not IsNull([联系电话]) Or _
   Not IsNull([纳税人识别号]) Or Not IsNull([现状]) Or Not IsNull([信用等级]) Or Not IsNull([行业]) Or _
   Not IsNull([性质]) Or Not IsNull([征收方式]) Then

窗体中所有 文本框 中只要有一个不为空时给出提示!
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
2#
发表于 2009-5-2 09:54:12 | 只看该作者
dim ctl as control
for each ctl in me.controls
if typeof ctl is textbox then
if not isnull(ctl) then
msgbox "Not Null"
end if
end if
next
3#
 楼主| 发表于 2009-5-2 11:34:41 | 只看该作者
谢谢版主!
如果还有组合框怎么判断啊?
4#
发表于 2009-5-2 13:55:11 | 只看该作者
Dim ctl As Control
    For Each ctl In Me.Controls
        If TypeOf ctl Is TextBox Or TypeOf ctl Is ComboBox Then
            If Not IsNull(ctl) Then
                MsgBox "Not Null"
                Exit For
            End If
        End If
    Next
5#
 楼主| 发表于 2009-5-3 08:43:25 | 只看该作者
谢谢版主了!
再多问句,如果反过来怎么做啊!就是说当窗体中所有文本框和组合框都为空的时候给出提示。
6#
发表于 2009-5-3 10:38:50 | 只看该作者
Dim ctl As Control
    Dim intCount As Integer, intNullCount As Integer
    For Each ctl In Me.Controls
        If TypeOf ctl Is TextBox Or TypeOf ctl Is ComboBox Then
            intCount = intCount + 1
            If IsNull(ctl) Then
                intNullCount = intNullCount + 1
            End If
        End If
    Next
    If intCount = intNullCount Then
        MsgBox "All Null"
    End If
7#
发表于 2009-5-3 10:52:55 | 只看该作者
dddddddd

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
8#
 楼主| 发表于 2009-5-4 10:07:23 | 只看该作者
谢谢版主!
搞定
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-9-21 14:49 , Processed in 0.099318 second(s), 33 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表