在一个 html 页面中,我创建了一个子窗口来执行一些过滤(选择打印机,以及要在报告上打印哪些部分)。为了在子窗口中显示部件选择,我需要从父窗口调用 GetParts 函数并将记录集返回给子窗口。这里有一些代码可以提供帮助:
从子窗口->
Sub LoadParts(frmRptFilter)
Dim sql
Dim oParts
Set oParts = CreateObject("ADODB.Recordset")
oParts.Fields.Append "Part", adBSTR , 30
oParts.Open
oParts = window.opener.GetParts(oParts) 'Since oParts was passed as a parameter I did not believe this to be necessary, but when it didn't work as expected I tried returning it this way....didn't work either
'more code follows
在父窗口中 ->
Function GetParts(oParts)
Dim sql
sql = "SELECT Job.Part_Number FROM Job RIGHT JOIN Packlist_Detail ON Packlist_Detail.Job = Job.Job "_
& "WHERE Packlist_Detail.Packlist LIKE '" & sPL & "'"
CloseRS(oRS)
oRS.Open sql, oConn, adOpenStatic, adLockReadOnly
oRS.MoveFirst
If Not (oRS.BOF AND oRS.EOF) Then
Do while not oRS.EOF
oParts.AddNew
oParts("Part").Value = oRS(0)
oParts.Update
oRS.MoveNext
Loop
End If
'GetParts = oParts 'Since oParts was passed as a parameter I did not believe this to be necessary, but when it didn't work as expected I tried returning it this way....didn't work either
End Function
我为一个软件编写报告,该软件需要我创建包含水晶报告对象的过滤器和报告 html 页面。我编写这些报告的软件限制了我在数据库连接等方面的能力。所以我不得不这样。
因此,我验证了父窗口中的 oParts 已正确填充。它做了什么!我只是无法将它填充到我的子窗口中。所以问题是,我如何在子窗口中取回一个值?