Unanswered: changing record source programmatically
I have an access form (Form A) with 2 command buttons on it. Button1 and Button2
Click Button1 and a second form (formB) opens. FormB also has a subform(SubFormB), which also has a sub form on it (SubSubformB). The record source for FormB is a table (Borrowers), and is linked to the child form (subformB) by fields phone1 and surname.
This is working ok.
Click Button2 and a third form (formC) opens. FormC also has a subform(SubFormB), which also has a sub form on it (SubSubformB – as above, the same form). The record source for FormC is a query (AddNewwindow), and is linked to the child form (subformB) by fields phone1 and surname. The criteria field in the query picks up on a field on form A, and shows in the query as forms!FormA.quotenumber
This also working well.
What I want to do is to be able to click either Button1 or Button2, and accordingly change the record source.
I have attempted to code this with no luck. If I change the record source in the properties box for FormB ( and get rid of formC completely – which is what I want to do) it works well. That is if I change the record source to either the table OR the query it does what I want. I have attempted a variety of syntax, all to no avail.
I have concentrated on coding on the Button2 click action.
many thanks, Very neat sltn, turned the grey matter. i ended up using openargs with a select case on the FormB in the form onopen whereby the case allows selection of recordsource. Still not working 100% but now probs getting subforms working correctly, hopefully nothing major.