在线等待,急救!!!!!!

15962 2003-12-19 10:48:48
(1)If Adodc1.Recordset.Fields(Combo3.Text) & Combo4.Text & Text1.Text Then
s = ""
For i = 0 To Adodc1.Recordset.Fields.Count - 1
s = s & Adodc1.Recordset.Fields(i).Value & Chr(vbKeyTab)
Next
List1.AddItem s
End If
说明,在(1)中
Combo3.Text是选择的字符
Combo4.Text 是选择的比较符 (>,<,=等等)
Text1.Text 是输入的比较的数据
该如何写这个语句?


(2)
Screen.MousePointer = vbHourglass

(出问题的语句)ret = findFirst(Adodc1.Recordset, txtFind.Text)
Screen.MousePointer = vbDefault

中的findFirst的定义为

Function findFind(rs As ADODB.Recordset, ByVal criteria As String)
On Error Resume Next
rs.MoveFirst
rs.Find criteria
findFirst = Not rs.EOF And Err.Number = 0
End Function
txtFind对象中调用了
Sub MakeFindString()
txtFind = "[" & Combo3 & "]" & Combo4

Select Case Adodc1.Recordset.Fields(Combo3).Type
Case adVarChar '字符
txtFind = txtFind & "'" & Text1 & "'"
Case adDate ' 日期
txtFind = txtFind & "# " & Text1 & "# "
Case Else
txtFind = txtFind & " " & Text1
End Select
End Sub
有什么问题啊?
我用vb不久,一直用vc的,不明白的估计会很多,谢谢
...全文
9 点赞 收藏 3
写回复
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
15962 2003-12-19
If Adodc1.Recordset.Filter(Combo3.Text & Combo4.Text & Text1.Text)
还是有问题,说类型不匹配
Function findFind(rs As ADODB.Recordset, ByVal criteria As String)应该为
Function findFirst(rs As ADODB.Recordset, ByVal criteria As String)

回复
landongfang 2003-12-19
Function findFind(rs As ADODB.Recordset, ByVal criteria As String)
On Error Resume Next
rs.MoveFirst
rs.Find criteria
if Not rs.EOF And Err.Number then
findFind=0

endif
End Function
回复
landongfang 2003-12-19
If Adodc1.Recordset.Filter(Combo3.Text & Combo4.Text & Text1.Text) Then
s = ""
For i = 0 To Adodc1.Recordset.Fields.Count - 1
s = s & Adodc1.Recordset.Fields(i).Value & Chr(vbKeyTab)
Next
List1.AddItem s
End If
回复
发动态
发帖子
VB基础类
创建于2007-09-28

7451

社区成员

VB 基础类
申请成为版主
社区公告
暂无公告