Next i
End If
' -----调用过程Fillgrid,向Grid2中添加查询到的记录
Fillgrid
End Sub
6.Combo1的单击事件
Private Sub Combo1_Click(Index As Integer)
' ----控制Combo1(4)与Combo1(1)同步,并根据Combo1(1)中选的字段不同,向Combo1(3)中添加这一字段下的所有不重复的值
Dim tempsql As String
If Index = 1 Then
Combo1(4).ListIndex = Combo1(1).ListIndex
Grid1.TextMatrix(Grid1.Row, 4) = Combo1(4).Text
tempsql = "SELECT DISTINCT " & Combo1(4).Text & " from " & strtable
opencn
openrs tempsql
closecn
fillcom1 Combo1(3), rs
End If
Grid1.TextMatrix(Grid1.Row, Index) = Combo1(Index).Text
If Grid1.Text = "True" Then
Grid1.Text = "1"
ElseIf Grid1.Text = "False" Then
Grid1.Text = "0"
End If
End Sub
7.Command1的单击事件
Private Sub Command1_Click(Index As Integer)
Dim i As Integer
Select Case Index
Case 0 '清除条件
Grid1.Rows = 2
For i = 0 To 4
Grid1.TextMatrix(1, i) = ""
Next i
Case 1 '增加行
Grid1.Rows = Grid1.Rows + 1
Case 2 '删除行
If Grid1.Rows > 2 Then
Grid1.Rows = Grid1.Rows - 1
Else
For i = 0 To 4
Grid1.TextMatrix(1, i) = ""
Next i
End If
End Select
End Sub
|