I select a product on a listbox that includes the Primary Key. I want to open another form, once a product is selected, with the subform of the newly opened form displaying the selected product details. I have tried all manner of 'solutions' but nothing has worked properly. This is what I am currently using - a simple piece of add record code. Note that if I manually insert the product ID then the rest of the data follows...
I have tried all manner of ways to 'force' the PK (productID) into the subform, and although I managed to do it once, it was SUCH a mess I carried on trying other methods.
To explain; in Northwind (for example), on the Orders Form, the user selects the product on the Order Form from a combo box - I can't use this solution because i have too many diverse products, so I need to be able to select them 'elsewhere' ...In order to be able to add more than one product to each order, the product details must show in a subform (the 'many' side). Am I being clear? Please help before I go finally nuts! Thanks guys, (Please note that the Variant datatype is merely me trying (apparently) everything!
Ston.
Code:
Option Explicit
'Add new product to sale
Dim rs As DAO.Recordset
Dim strwhere As Variant
strwhere = Me.List55.Column(0)
Set rs = Form_frm_quotation.frm_quotationSubfrm.Form.RecordsetClone
rs.AddNew
rs!ProductID = strwhere
rs.Update
DoCmd.OpenForm "frm_quotation"
I have tried all manner of ways to 'force' the PK (productID) into the subform, and although I managed to do it once, it was SUCH a mess I carried on trying other methods.
To explain; in Northwind (for example), on the Orders Form, the user selects the product on the Order Form from a combo box - I can't use this solution because i have too many diverse products, so I need to be able to select them 'elsewhere' ...In order to be able to add more than one product to each order, the product details must show in a subform (the 'many' side). Am I being clear? Please help before I go finally nuts! Thanks guys, (Please note that the Variant datatype is merely me trying (apparently) everything!
Ston.
Comment