SkeletorPlus
New member
- Local time
- Today, 13:37
- Joined
- Jun 11, 2025
- Messages
- 16
Hi. I have the following basic structure:
A System table with SystemID and SystemName;
A Groups table with GroupID, SystemID (FK), and GroupName;
An Accounts table with AccountID, SystemID (FK), and AccountUsername;
An AccountGroups table with AccountGroupID, GroupID, and AccountID.
I have a form that shows Accounts, and want to have a subform where the user can add what Active Directory groups that user is apart of. Groups will be on the subform and link master/child based on AccountID, but I want the options in the Group combo box to only show options where the SystemID is the same for both. I am having trouble understanding what I need to do for the query (base it off a record set or a control in the main form?) and for what type of events I need to have to make this work (after update, on current, etc). Anyone have some good examples or advice?
Edit: posting answer here for others to see, as Claude gave me a solution that does what the post was asking:
SELECT AccountGroups.AccountGroupsID, AccountGroups.AccountId, AccountGroups.GroupID, Groups.GroupName, Groups.SystemID FROM AccountGroups INNER JOIN AccountGroups ON AccountGroups.GroupID = Groups.GroupID
2. Combo Box Row Source
For the Group combo box in the subform, you'll need a dynamic row source. Call this something like qryFilteredComboBox:
SELECT GroupID, GroupName FROM Groups WHERE SystemID = Forms![YourFormName]!SystemID
Set this as your combo box’s rowsource.
Now make an On Current event in your main form:
Sub Form_Current()
Me.YourSubformControlname.form!YourGroupCombo.requery
End Sub
Hope this can help someone in the future!
A System table with SystemID and SystemName;
A Groups table with GroupID, SystemID (FK), and GroupName;
An Accounts table with AccountID, SystemID (FK), and AccountUsername;
An AccountGroups table with AccountGroupID, GroupID, and AccountID.
I have a form that shows Accounts, and want to have a subform where the user can add what Active Directory groups that user is apart of. Groups will be on the subform and link master/child based on AccountID, but I want the options in the Group combo box to only show options where the SystemID is the same for both. I am having trouble understanding what I need to do for the query (base it off a record set or a control in the main form?) and for what type of events I need to have to make this work (after update, on current, etc). Anyone have some good examples or advice?
Edit: posting answer here for others to see, as Claude gave me a solution that does what the post was asking:
Main Form Setup
Your main form should be bound to the Accounts table or a query based on it.Subform Setup
1. Subform Record Source Query
Create a query for your subform that joins AccountGroups with Groups to show group names:SELECT AccountGroups.AccountGroupsID, AccountGroups.AccountId, AccountGroups.GroupID, Groups.GroupName, Groups.SystemID FROM AccountGroups INNER JOIN AccountGroups ON AccountGroups.GroupID = Groups.GroupID
2. Combo Box Row Source
For the Group combo box in the subform, you'll need a dynamic row source. Call this something like qryFilteredComboBox:
SELECT GroupID, GroupName FROM Groups WHERE SystemID = Forms![YourFormName]!SystemID
Set this as your combo box’s rowsource.
Now make an On Current event in your main form:
Sub Form_Current()
Me.YourSubformControlname.form!YourGroupCombo.requery
End Sub
Hope this can help someone in the future!
Last edited: