设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

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

[窗体] 怎样用窗体显示这段代码的结果?

[复制链接]
跳转到指定楼层
1#
发表于 2002-5-23 06:03:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
Option Compare Database
Option Explicit

Private Sub Cmd查询_Click()
    Dim Lpx1 As Command
    Dim rs1 As Recordset, str1 As String
    Dim fldloop As ADODB.Field
     'defind and execute command
     Set Lpx1 = New ADODB.Command
     With Lpx1
        .ActiveConnection = CurrentProject.Connection
        .CommandText = "SELECT tbl住户.*  FROM tbl住户"

        .CommandType = adCmdText
        .Execute
     End With
    'open and print recordset
    Set rs1 = New ADODB.Recordset
    rs1.Open Lpx1
    Do Until rs1.EOF
        str1 = ""
        For Each fldloop In rs1.Fields
            str1 = str1 & fldloop.Value & Chr(9)
        Next fldloop
        'DoCmd.OpenForm "frm查询1"
        Debug.Print str1
        rs1.MoveNext
    Loop
End Sub

在立即窗口可以显示,但在窗体怎么显示呢?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅

点击这里给我发消息

2#
发表于 2002-5-23 06:16:00 | 只看该作者
使用ListView控件可以实现,把str1放到节点中
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-4-29 13:45 , Processed in 0.089704 second(s), 25 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

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