So i have reviewed what i previously had and changed things around a little. I have progressed a little by referring back to previous help Etc. So uploaded is same database V1.13 Here I now have the form ECNListByCustomers added. So when i open the form without touching the customer listbox i have a full list of ECN data in the ECN List listbox. After pressing refresh this updates the subform in accordance with the chosen ECN. I can then add PartNumber and Description. However I would like to filter the ECN List listbox depending on the Customer chosen. I have tried to edit the previous macro but the best i can achieve so far is for the ECN List listbox to clear. I feel I am very close but no matter how much tinkering i do with the macro i cant manage to get it to work. I did add a second refresh box in case it was a refresh problem but no joy so removed it for now. I would also like to have the current refresh box removed but happy to stay with it until immediate issue is resolvedProject Tracking Test V1.13.odb
+1 for a fairly good question. Two suggestions for improvement: Add a link to the previous question (which I did for you), and add paragraph breaks to make it easier to read.
The query in CustChange2
is looking in the wrong table. Also, it should grab two fields: one for the ECN number to display and one for the underlying ID. Here is the corrected query.
sSql = "SELECT ""ECN-RFQ Reference"", ""ECN-RFQID"" FROM ""ECN-RFQ"""&_
" WHERE ""CustomerID"" = '" & sSelectedValue & "' ORDER BY ""ECN-RFQID"" ASC"
There is also another problem with the sample you posted. If you do select anything in Customer
list box you will get an error:
BASIC runtime error.
Property or method not found: SelectedValue.
This is because there are two controls on the form with the same name: txtCustomer
One is the label control for the list box and the other is the listbox itself. Change the name for the label control to something else.
Thanks guys, the duplicate name was careless. I am going to post another question regarding naming of fields.
I will update the names and see if I can get it to work without looking at the above solution as I do like to be able to make a little progress. I will come back with my progress. Thanks guys.