Hi,
I find myself writing a simple database in access for recording customers orders, just two tables, customers and orders in a one to many relationship, its about 30 years since I last coded in access and about 15 since I last wrote any vba code so there is some dusting off of the memory and grey matter here so apologies if my terminology is off.
I have created the db, tables, relationship and key fields and used the access wizard to build a form around the customers with a subform for the orders associated with those customers, which all works fine.
I've managed to code a better search for customers in vba which works well, and what I would like to do now is have a toggle or an on and off button filter to show or hide completed orders in the subform/orders table.
Looking at examples online I have tried building a filter and applying it to the subform but it fails, I have also tried directly addressing the subform in code to filter it but nothing is currently working for me, I think my problem is that all the examples I look at refer the the subform as a subform i.e. a form view of the table however looking at the way that the access form wizard has created the subform it looks more like a directly embeded table object than a form and the form object is called "Table.CusotmerOrders" and not "Subform or Form.CustomerOrders" which is what I am expecting based on the examples I have found online.
So the main form is called CustomerOrderEntry and the embeded object with the orders table in is called Table.CustomerOrders with the actual table being CustomerOrders, to refer to this I have tried the following:
The Field is called Completed and is a yes/no value
Forms!CustomerOrderEntry.CustomerOrders.Table.Filt er = "[Completed]= " & "No"
Forms!CustomerOrderEntry.CustomerOrders.Table.Filt erOn = True
So set the filter for the form then apply it, however it returns an error and halts the code so obviously I am missing something due to my lack of experience of current access/vba.
Could anyone point me in the right direction or point out what is probably an obvious fault with my code/approach?
Kind regards