mikenelena
Board Regular
- Joined
- Mar 5, 2018
- Messages
- 139
- Office Version
- 365
- Platform
- Windows
I am changing record sources of a subform based on the selection of a combo box in a parent subform. My overall structure looks like this: Main form is Clients. Embedded into that is a subform for Branch Offices. Embedded into that subform is a subform container featuring tab controls. One of those tabs is for a schedule of fees.
A combo box on the branch level subform holds the options Standard & Custom. Depending on which is selected, the subform container changes record sources between the 2 tables mentioned.
The filtering for the Custom fee schedule currently works based on Branch_ID. However, some companies have dozens of branch offices and with about 30+ items on the fee schedule, I don't want to repeat data in the table unnecessarily. I would like to filter based on Client_ID instead of on Branch_ID, as this seems easiest. Client_ID is a numeric field in the table, and a matching value exists in a control in my form, and on both subforms. I can't seem to get this to work though.
The filter fields in my form are blank. I'm trying to handle this with VBA. I've tried this line, and all kinds of variations on it.
I know I have the code wrong, but am I at least going about this the right way? Should I be filtering at the form instead of in VBA?
The second part of my question is this. Can I filter on the Branch_ID and avoid a table full of repeating data somehow?
Thank you all for any assistance you might be able to provide me!
...Mike
A combo box on the branch level subform holds the options Standard & Custom. Depending on which is selected, the subform container changes record sources between the 2 tables mentioned.
The filtering for the Custom fee schedule currently works based on Branch_ID. However, some companies have dozens of branch offices and with about 30+ items on the fee schedule, I don't want to repeat data in the table unnecessarily. I would like to filter based on Client_ID instead of on Branch_ID, as this seems easiest. Client_ID is a numeric field in the table, and a matching value exists in a control in my form, and on both subforms. I can't seem to get this to work though.
The filter fields in my form are blank. I'm trying to handle this with VBA. I've tried this line, and all kinds of variations on it.
VBA Code:
Me.Filter = "Client_ID = " & Client_ID
Me.filterOn = True
I know I have the code wrong, but am I at least going about this the right way? Should I be filtering at the form instead of in VBA?
The second part of my question is this. Can I filter on the Branch_ID and avoid a table full of repeating data somehow?
Thank you all for any assistance you might be able to provide me!
...Mike