Reputation: 109
I have two tables that I display in a form:
tblUsers -> user_id, firstname, lastname, group_id
tblGroups -> group_id, groupName, groupDesc
I can get the data that I want with:
SELECT tblUsers.firstname, tblUsers.lastname, tblGroups.groupName FROM tblGroups INNER JOIN tblUsers ON tblGroups.[group_id] = tblUsers.[group_id];
But what I need is a form that shows the user information and a dropdown list for the group but showing the name of the group not the ID and so the group can be changed for a specific user e.g. Manager, Editor etc...
Thanks, Gareth
Upvotes: 3
Views: 6095
Reputation: 8402
Right-click on the ComboBox (assuming it's a ComboBox...) and open the Properties window.
Set the Row Source to:
Select Group_ID, GroupName from tblGroups
Set the Column Count to 2, because you want the combo to store both the ID and the Group name
Set the Column Widths to "0; 2" (without the quotes). This will essentially hide the ID because the column width of the ID field is 0.
Set the Bound Column to 1, because you want to bind to the ID column and not the Group Name column, because the Group ID is easier to query with.
Then you reference the combo with Me!MyComboboxName.Value to get the Group ID.
Upvotes: 10