大家看仪下 散分
当你CLICK事件后 在单击他就回在原来的记录下 在继续添加记录~~
我想 在下次CLICK事件开始前 清除以前的记录怎么弄啊~
各位大哥大街~~
Private Sub Command3_Click()
On Error Resume Next
Dim strsql As String
MSFGrid2.AllowBigSelection = True
strsql = "select * from cs_manager where 1=1 "
If Combo1.Enabled = True Then strsql = strsql & " and mdan= ' " & Trim(Combo1.Text) & " ' "
If Combo2.Enabled = True Then strsql = strsql & " and mddj= " & Trim(Combo2.Text) & " "
If Combo3.Enabled = True Then strsql = strsql & " and mdper= ' " & Trim(Combo3.Text) & " ' "
If Combo4.Enabled = True Then strsql = strsql & " and mdnum= " & Trim(Combo4.Text) & " "
If DTPicker1.Enabled = True Then strsql = strsql & " and mdtime= " & DTPicker1.Value & " "
If runsql(strsql) = True Then
If rct.EOF Then Exit Sub
rct.MoveFirst
With MSFGrid2
Do While Not rct.EOF
.AddItem " "
.Row = .Rows - 2
.Col = 0:
.Text = rct!mdan
.Col = 1
.Text = rct!mdpro
.Col = 2
.Text = rct!mdnum
.Col = 3
.Text = rct!mddj
.Col = 4
.Text = rct!mdtime
.Col = 5
.Text = rct!mdper
rct.Update
rct.MoveNext
Loop
End With
Else
End If
End Sub
[解决办法]
Private Sub Command3_Click()
On Error Resume Next
Dim strsql As String
MSFGrid2.AllowBigSelection = True
MSFGrid2.rows=1 '这里
strsql = "select * from cs_manager where 1=1 "
If Combo1.Enabled = True Then strsql = strsql & " and mdan= ' " & Trim(Combo1.Text) & " ' "
If Combo2.Enabled = True Then strsql = strsql & " and mddj= " & Trim(Combo2.Text) & " "
If Combo3.Enabled = True Then strsql = strsql & " and mdper= ' " & Trim(Combo3.Text) & " ' "
If Combo4.Enabled = True Then strsql = strsql & " and mdnum= " & Trim(Combo4.Text) & " "
If DTPicker1.Enabled = True Then strsql = strsql & " and mdtime= " & DTPicker1.Value & " "
If runsql(strsql) = True Then
If rct.EOF Then Exit Sub
rct.MoveFirst
With MSFGrid2
Do While Not rct.EOF
.AddItem " "
.Row = .Rows - 2
.Col = 0:
.Text = rct!mdan
.Col = 1
.Text = rct!mdpro
.Col = 2
.Text = rct!mdnum
.Col = 3
.Text = rct!mddj
.Col = 4
.Text = rct!mdtime
.Col = 5
.Text = rct!mdper
rct.Update
rct.MoveNext
Loop
End With
Else
End If
End Sub