I'm currently working on an Access subform which is displayed in datasheet view on another form. The subform contains a combobox called "cboResourceType" and a listbox called "lboResourceName", along with a few other fields. When the form displays existing data, there is one row of data in the subform for each record in the "EventResourcesDetails" table.
The "cboResourceType" combo box displays the ResourceType just fine. However, the
"lboResourceName" listbox is inconsistent in what it displays.
When the listbox is initially shown, everything looks fine. The correct words for the resource name are visible. And if I click on the dropdown arrow for the listbox, I see the correct list of valid resource names to choose from. But if I attempt to change the ResourceName by clicking on a different choice, the corresponding resource id (the numeric bound column for the listbox) is then shown in the listbox display, and is then actually stored in the ResourceName field in the EventResourcesDetails table. Meanwhile, the ResourceID field does not change in the table itself. So as an example, I end up with an EventResourcesDetails table record with a ResourceID of 3 (the old ID), and a ResourceName of 4 (the new ID). What I want to happen is that the ResourceID changes from 3 to 4, and the ResourceName changes to the appropriate wording.
Here's some info on the listbox:
lboResourceName
RowSourceType: Table/Query
RowSource: SELECT [Resources].[ResourceID], [Resources].[ResourceName]
FROM Resources WHERE
[Resources].[ResourceTypeID]=[forms]![MediaResources]![MediaResourcesSubform]!ResourceType
ORDER BY [Resources].[ResourceName];
ControlSource: ResourceName
ColumnCount: 2
ColumnWidths: 0",2"
Bound Column: 1
How can I always see the valid ResourceName in the listbox display, instead of the ResourceID field (and also have the data stored correctly in the table)?
Thanks for your help. (I'm fairly new to VBA, so please keep explanations simple...)
- Anita