设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

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

[窗体] 动态生成窗体

[复制链接]
跳转到指定楼层
1#
发表于 2008-4-8 16:47:24 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
Dim strSelect As String
    Dim strWhere As String
   
    strSelect = ""
    strWhere = ""
        '判断要显示的字段
    If Me.Check1 = True Then
        strSelect = strSelect & "Email,"
    End If
   
    If Me.Check2 = True Then
        strSelect = strSelect & "Add,"
    End If
   
    If Me.Check3 = True Then
        strSelect = strSelect & "Ctc,"
    End If
   
    If Me.Check4 = True Then
        strSelect = strSelect & "Region,"
    End If
   
    If Me.Check5 = True Then
        strSelect = strSelect & "Tel,"
    End If
   
    If Me.Check6 = True Then
        strSelect = strSelect & "Fax,"
    End If
   
    If Me.Check7 = True Then
        strSelect = strSelect & "product,"
    End If
   
    If Me.Check8 = True Then
        srSelect = strSelect & "brands,"
    End If
   
    If Me.Check9 = True Then
        strSelect = strSelect & "Webseit,"
    End If
   
    If Me.Check10 = True Then
        strSelect = strSelect & "Halle,"
    End If
   
    If Me.Check11 = True Then
        srSelect = strSelect & "Stand,"
    End If
   
    If Me.Check12 = True Then
        strSelect = strSelect & "Messe,"
    End If
       '判断选择条件
    If Not IsNull(Me.Region) = True Then
        strWhere = strWhere & "C_Info.Region = Me.Region AND "
    End If
   
    If Not IsNull(Me.Product) = True Then
        strWhere = strWhere & "C_Info.Product = Me.Product AND "
    End If
   
    If Not IsNull(Me.Cname) = True Then
        strWhere = strWhere & "C_Info.Cname = Me.Cname AND "
    End If
   
    If Len(strWhere) > 0 Then
      '有输入条件
      strWhere = Left(strWhere, Len(strWhere) - 5)
    End If
   
    If Len(strSelect) > 0 Then
      '有查询条件
      strSelect = Left(strWhere, Len(strWhere) - 1)
  End If
   
我想做个如下查询
Select strSelect
From C_Info
Where strWhere
然后把结果动态生成一个窗体显示出来
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏1 分享分享 分享淘帖 订阅订阅
2#
 楼主| 发表于 2008-4-8 17:00:39 | 只看该作者
附件

本帖子中包含更多资源

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

x
3#
发表于 2008-4-8 17:29:46 | 只看该作者
动态生成窗体?有意义吗?在MDE里全玩完.不如显示出查询得了
要不在窗体里预设一定量的控件,在打开时重新布局各控件数据来源及显示

点击这里给我发消息

4#
发表于 2008-4-8 17:46:16 | 只看该作者
在MDE不能动态生成控件,也不支持控件数组,这是Access最不好的地方
5#
 楼主| 发表于 2008-4-8 18:51:57 | 只看该作者
我也不知道怎么弄 不管什么方法 只要能实现我所需要的功能就行
6#
发表于 2008-4-8 19:32:30 | 只看该作者
供参考

本帖子中包含更多资源

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

x
7#
 楼主| 发表于 2008-4-9 00:01:40 | 只看该作者
[:12] [:12] 非常感谢
8#
发表于 2008-4-9 08:47:27 | 只看该作者
andymark    不错哦,学习[:36]
9#
发表于 2016-4-9 23:28:54 | 只看该作者
支持原创
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-6-19 17:14 , Processed in 0.080832 second(s), 33 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

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