Link to home
Start Free TrialLog in
Avatar of Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.Sc
Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.ScFlag for Zambia

asked on

Referencing a sub form control from a parent form

The code below is not populating the record into the subform from a query it says too few parameters , this is supposed to be a simple thing its now frustrating, kindly see below:

Private Sub CmdGetGrns_Click()
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("QryPurchasesOrderFin", dbOpenDynaset, dbSeeChanges)
Do Until rs.EOF
Forms![frmGrn].Form![sfrmGrnDetails Subform]![PurchasesID].AddItem rs("PurchasesID")
Forms![frmGrn].Form![sfrmGrnDetails Subform]![ProductID].AddItem rs("ProductId")
Forms![frmGrn].Form![sfrmGrnDetails Subform]![Qty].AddItem rs("Quantity")
Forms![frmGrn].Form![sfrmGrnDetails Subform]![Cost].AddItem rs("CostValue")
Loop
End Sub

Open in new window



The query  where the data is suppose to come from

SELECT tblPurchasesHeader.PurchaseID, tblPurchasesDetailslines.ProductID, tblPurchasesDetailslines.Quantity, tblPurchasesDetailslines.CostValue
FROM tblPurchasesHeader INNER JOIN tblPurchasesDetailslines ON tblPurchasesHeader.PurchaseID = tblPurchasesDetailslines.PurchaseID
WHERE (((tblPurchasesHeader.PurchaseID)=[Forms]![frmGrn]![CboOrder]));

Open in new window



See if you can see the problem here!

Regards

Chris
ASKER CERTIFIED SOLUTION
Avatar of Daniel Pineault
Daniel Pineault

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial