在一个窗口中建立一个多选框,主要包括:
多选框Check1日期 从text1到text2
多选框Check2名称TEXT3
多选框Check3用途TEXT4
多选框Check4经手人text5
多选框Check5领用人text6
多选框Check6备注text7
单击commond1打开另一个窗口form4
在form4中的dbgird显示查询的结果请帮帮忙写出具体步骤,还要添加什么控件
我对VB不是学得很好
在线等

解决方案 »

  1.   

    iwhere = False
    ssql = "select * from 表"
        If Text1.Text <> "" Then
            ssql = ssql & " where Fw =" & Text1.Text & ""
            iwhere = True
        End If
        
        If Text2.Text <> "" Then
            If iwhere = True Then
                ssql = ssql & " and Ew = " & Text2.Text & ""
            Else
                ssql = ssql & " where Ew=" & Text2.Text & ""
                iwhere = True
            End If
        End If
        
        If Text3.Text <> "" Then
            If iwhere = True Then
                ssql = ssql & " and Bc=" & Text3.Text & ""
            Else
                ssql = ssql & " where Bc=" & Text3.Text & ""
                iwhere = True
            End If
        End If
        以此类推,然后set datagrid1.datasource=ssql
      

  2.   

    调试结果,查询里找不到工程库iwhere
      

  3.   

    iwhere
    好象是一个自己定义的 BOOLEN变量吧楼主在窗体中定义一下
      

  4.   

    Dim riqi As String
    Dim name As StringIf Check1.Value = 1 Then
    riqi = Text1.Text
    End If
    If Check2.Value = 1 Then
    name = Text3.Text
    End Ifsql  语句为:"select * from 表 where 日期 =' & riqi & "'" and 名称= name and   and "把查询结果.addnew到form4连接的数据库中
    form4.show
      

  5.   

    先定义一个数据集全局变量
    你查询后得到的结果----》全局变量,
    再form4.show
    form4.datagrid1.datasource=全局变量