根 据 用 户 的 选 择 建 立 查 询 字 符 串, 并 引 发GetSelectionSql 事 件 返 回 字 符 串; 单 击" 取 消" 时, 关 闭 查 询 窗 体。
Private Sub Command1_Click(Index As Integer)
Select Case Index
Case 0 注释:确定
SelectionSql = " WHERE "
For i = 0 To Check1.Count - 1
If Check1(i).Value = 1 Then
If SelectionSql < > " WHERE " Then
If Option1((i - 1) * 2) Then
SelectionSql = SelectionSql & " AND "
Else
SelectionSql = SelectionSql & " OR "
End If
End If
If Combo1(i * 3) < > "" Then
SelectionSql = SelectionSql & Combo1(i * 3)
Else
SelectionSql = ""
MsgBox "该项还未设值!", 64, "
查询条件:"
Combo1(i * 3).SetFocus
Exit Sub
End If
If Combo1(i * 3 + 1) < > "" Then
SelectionSql = SelectionSql & " " & Combo1(i * 3 + 1) _ & " "
Else
SelectionSql = ""
MsgBox "该项还未设值!", 64, "
查询条件:"
Combo1(i * 3 + 1).SetFocus
Exit Sub
End If
SelectionSql = SelectionSql _
& CheckType(rs(Combo1(i * 3).Text).Type, _ Combo1(i * 3 + 2))
End If
Next i
If SelectionSql = " WHERE " Then SelectionSql = ""
If Check2.Value = 1 Then
MsgBox "SelectionSql = " & SelectionSql , 64, "
查询字符串:"
End If
RaiseEvent GetSelectionSql(SelectionSql)
Unload Parent
Case 1 注释:取消
Unload Parent
End Select
End Sub
---- (7) 自 定 义 过 程: 给 左 列 组 合 框 置 值- 表 的 列 名 。
Private Sub LoadCboLeft(ByVal Cbo As ComboBox)
If rs.EOF And rs.BOF Then
MsgBox Tablename & "表中无记录!", 64, "
查询条件:"
Exit Sub
End If
rs.MoveFirst
For i = 0 To rs.Fields.Count - 1
Cbo.AddItem rs(i).Name
Next
&nb