GetRS是个自定义函数,用于创建记录集。
Dim Cnxn As New ADODB.Connection
Dim Rs As New ADODB.Recordset
Dim strSQL As String
Dim strDbName As String '数据库名称包含路径
strDbName = "......"
Cnxn.ConnectionString = "rovider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDbName
strSQL = "SELECT * FROM 表1 WHERE 分类 = '" & Me.txt & "'"
Rs.Open strSQL, Cnxn, adOpenStatic, adLockOptimistic
If Not Rs.EOF Then
set me.子窗体.form.recordset = rs
End If
Rs.Close
Cnxn.Close
Set Rs = Nothing
Set Cnxn = Nothing
[此贴子已经被作者于2006-10-22 10:48:30编辑过]
|