设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

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

[高0]求最短的代码.

[复制链接]
1#
发表于 2005-3-20 23:28:00 | 显示全部楼层


Private Sub 命令0_Click()

    Dim i As Integer, j As Integer, strSql(4) As String

    For i = 0 To DCount("*", "表1") - 1

        strSql(1) = strSql(1) & " & [" & i & "]"

        strSql(2) = strSql(2) & ",[" & i & "].txt as " & i

        strSql(3) = strSql(3) & ",表1 as " & i

        For j = i + 1 To DCount("*", "表1") - 1

            strSql(4) = strSql(4) & " and [" & i & "]<>[" & j & "]"

        Next j

    Next

    CurrentDb().QueryDefs("Sql").SQL = "SELECT " & Mid(strSql(1), 4) & " as Str FROM (select " & Mid(strSql(2), 2) & " from " & Mid(strSql(3), 2) & ") where (" & Mid(strSql(4), 6) & ")"

    DoCmd.OpenQuery "Sql"

End Sub

本帖子中包含更多资源

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

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

本版积分规则

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

GMT+8, 2024-5-15 01:28 , Processed in 0.094917 second(s), 24 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

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