在打开的记录集下如何再进行检索操作,先前在程序启动时已打开了记录(ADORS.OPEN "SELECT *........),程序中加一检索功能按钮要执行查询操作当如何处理,用什么语句,如果再OPEN记录集的话程序是会报错的。请各位指教!
解决方案 »
- 图片旋转(大家来帮帮忙哦)
- 怎样把日期调成这样的形式,01-sep-05,10:10:10
- 请问在EXCEL的VBA中如何以只读方式打开EXCEL文件?谢谢!
- 用vsFlexGrid控件对Access数据库的编辑、保存?
- 我记得有个API可以自动省略缩写路径全称的,但我忘了名字,谁能提供一下。
- 来看看这个代码哪里有错误,怎么都是返回的false啊,快进来看看,在线等待!!!!!!!
- 急!!!关于数据库的问题???
- 关于<--高手帮忙啊-->的额外分数
- vb和accsee做项目,对多用户的可以实现吗?
- vb鼠标点击窗口内某一固定坐标怎么做
- 使用printer对象打印,如何控制打印结束的位置,使之不换页打印。
- vb+sql2000超难!在线等!
即二次过滤的例子Public Sub FilterX() Dim rstPublishers As ADODB.Recordset
Dim rstPublishersCountry As ADODB.Recordset
Dim strCnn As String
Dim intPublisherCount As Integer
Dim strCountry As String
Dim strMessage As String ' Open recordset with data from Publishers table.
strCnn = "Provider=sqloledb;" & _
"Data Source=srv;Initial Catalog=pubs;User Id=sa;Password=; "
Set rstPublishers = New ADODB.Recordset
rstPublishers.CursorType = adOpenStatic
rstPublishers.Open "publishers", strCnn, , , adCmdTable ' Populate the Recordset.
intPublisherCount = rstPublishers.RecordCount ' Get user input.
strCountry = Trim(InputBox( _
"Enter a country to filter on:")) If strCountry <> "" Then
' Open a filtered Recordset object.
Set rstPublishersCountry = _
FilterField(rstPublishers, "Country", strCountry) If rstPublishersCountry.RecordCount = 0 Then
MsgBox "No publishers from that country."
Else
' Print number of records for the original
' Recordset object and the filtered Recordset
' object.
strMessage = "Orders in original recordset: " & _
vbCr & intPublisherCount & vbCr & _
"Orders in filtered recordset (Country = '" & _
strCountry & "'): " & vbCr & _
rstPublishersCountry.RecordCount
MsgBox strMessage
End If
rstPublishersCountry.Close End IfEnd SubPublic Function FilterField(rstTemp As ADODB.Recordset, _
strField As String, strFilter As String) As ADODB.Recordset ' Set a filter on the specified Recordset object and then
' open a new Recordset object.
rstTemp.Filter = strField & " = '" & strFilter & "'"
Set FilterField = rstTempEnd Function