The thread has examples, but when I try to download them, I get a message that the zip files are corrupted.
I have a main form with a subform. The subform contains records which have the same job code as the main form. Each record in the subform is created by a specific user, and I want to use a drop down box in the main form to select a user, and then display all records in the subform that the user has entered. I also want an option in the list to show All records, so the user can see entries from other users.
1. Create a new form that will become the subform (you can use the wizard, if you're not used to working with Access), select the fields you want to see in it and save it (let's call it SF_Jobs).
2. Create a new form that will become the parent (main) form and arrange it the way you want (Wizard O.K.).
3. Add a SubForm/SubReport control to it (let's call it Child_Jobs). If you use the wizard, left the LinkChildFields and the LinkMasterFields blank or remove their values afterwards. For the SourceObject, enter the name of the subform (SF_Jobs).
4. Add a ComboBox to it (let's call it Cbo_Users) but don't use the wizard. Assign this to its RowSource property (adapt the names to those in your database):
SELECT DISTINCT user FROM Tbl_Job ORDER BY user
SELECT ' All' FROM Tbl_Job
Notice the space in front of ' All'.
5. Create an Event Handler for the AfterUpdate event of the ComboBox, like this:
Private Sub Cbo_Users_AfterUpdate()
If Me.Cbo_Users.Value = " All" Then
Me.Child_Jobs.Form.Filter = ""
Me.Child_Jobs.Form.FilterOn = False
Me.Child_Jobs.Form.Filter = "user = '" & Me.Cbo_Users.Value & "'"
Me.Child_Jobs.Form.FilterOn = True
I've tried what you suggested and got a bit lost, so I've decided to try and simplify things until I can build my skills up. I've looked at some other responses of yours and think this one may be what I'm looking for http://www.dbforums.com/microsoft-ac...g-subform.html with the following code which works.
The syntax is: Me.Control.Form.Control, with Me being a reference to the Form (or the Report) where the code is being excecuted. The Form object is a property of the control, not of itself, if I may say so.
Moreover, I'm not sure that ADC_REC_Add_Final is needed in ADC_REC_Add_Final.Details, it depends on the subform RecordSource.