在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被正確填充。它做什麼!我無法將它填充到我的子窗口中。所以問題是,我如何在子窗口中獲取值?
GetParts調用後的oParts中有什麼? – Tester101 2009-04-16 17:01:28
我現在正在使用的實際報告是客戶PO放置提貨袋的標籤,但它的實際Packlist報告已用完,因此我無法將此信息放在父窗口中。我的那個孩子窗口可以讓你選擇打印機和零件,因此可以選擇oParts作爲標籤。 – 2009-04-16 18:43:07