【求助】关于数据库的查询功能
同一工程下我设置了两个窗体:一个是查询界面,一个是查询结果界面,公共模块里是有关执行SQL的函数,返回查询记录集,代码如下:Public Function ExecuteSQL(ByVal SQL As String, MsgString As String) As ADODB.Recordset
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim sToken() As String
On Error GoTo ExecuteSQL_ERROR
Set cnn = New ADODB.Connection
cnn.Open ConnectString
……(略)
Set rst = New ADODB.Recordset
rst.Open Trim$(SQL), cnn, adOpenDynamic, adLockOptimistic
Set ExecuteSQL = rst ‘ 函数返回查询的记录集
MsgString = "查询到" & rst.RecordCount & "条记录。"
……(略)
End Function
Public Function ConnectString() As String
Dim str As String
str = App.Path
If Right$(str, 1) <> "\" Then
str = str & "\"
End If
ConnectString = "……" & str & "***.mdb; ……" ’返回连接字符串,ExecuteSQL函数调用
End Function
我的问题是:查询窗体中返回的结果记录集,如何保留到另外那个结果窗体中显示出来?最好不要用MDI的,否则我要重做了……