Mathematician
Registered User.
- Local time
- Today, 16:35
- Joined
- Nov 23, 2007
- Messages
- 17
Hi guys,
it is very useful to use the treeview or listbox control, let's say with multiply selection property. You can use the CTRL key to select multiply values in them.
I have a problem to manage the selection. Do you know the way to refer to the selected values as they were some kind of list or table? Like:
DOCMD.RUNSQL "SELECT * INTO [TEMP] FROM " & ME.TREEVIEW.SELECTED_VALUES
or
DOCMD.RUNSQL "SELECT * INTO [TEMP] FROM " & ME.LISTBOX.SELECTED_VALUES
The only way I found for the moment is to go through all nodes and verify manually if they are checked or not or in case of listbox go through all the selected items. But if access knows all the time which values are selected, it means that they are recorded somewhere so there must be the way to extract them in more efficient way than going along all values.
I found also another efficient way that I would recommend you:
Listbox or treeview usually is created based on some table. In the source table you can create additional columns: [index_id] and [check_indicator]. [Index_id] refers to the same index as available in treeview or lisbox. [check_indicator] is always "0" by default.
[On change] event you update [check_indicator] column in source table for records that are selected in your control. You have know the table of all selected items all the time and you can refer to them however you want. This is good if you work with active x controls and once you lose the focus you lose the selection.But then you can recover selection very easily.
But it is still the same approach to go through all items every time.
Any advice from your side will be priceless.
Mathematician
it is very useful to use the treeview or listbox control, let's say with multiply selection property. You can use the CTRL key to select multiply values in them.
I have a problem to manage the selection. Do you know the way to refer to the selected values as they were some kind of list or table? Like:
DOCMD.RUNSQL "SELECT * INTO [TEMP] FROM " & ME.TREEVIEW.SELECTED_VALUES
or
DOCMD.RUNSQL "SELECT * INTO [TEMP] FROM " & ME.LISTBOX.SELECTED_VALUES
The only way I found for the moment is to go through all nodes and verify manually if they are checked or not or in case of listbox go through all the selected items. But if access knows all the time which values are selected, it means that they are recorded somewhere so there must be the way to extract them in more efficient way than going along all values.
I found also another efficient way that I would recommend you:
Listbox or treeview usually is created based on some table. In the source table you can create additional columns: [index_id] and [check_indicator]. [Index_id] refers to the same index as available in treeview or lisbox. [check_indicator] is always "0" by default.
[On change] event you update [check_indicator] column in source table for records that are selected in your control. You have know the table of all selected items all the time and you can refer to them however you want. This is good if you work with active x controls and once you lose the focus you lose the selection.But then you can recover selection very easily.
But it is still the same approach to go through all items every time.
Any advice from your side will be priceless.
Mathematician