Cannot access the selected table (Error 1152)
The error is related to the RowSource or ControlSource of a ListBox/ComboBox.
Possible sources of this error:
- The RowSource cursor for ListBox/ComboBox has been closed or recreated in another work area. It seems that a ListBox/ComboBox remembers connection with its RowSource by workarea number not by alias. Setting ListBox/ComboBox RowSource to an empty string before query is run and restoring after would help.
- The RowSource of the multiple Combo/ListBoxes are SQL's which create cursor with the same name. Making cursor name unique fixes the problem.
- The ControlSource table/cursor of an object is closed before the object is destroyed. Move the code that closes the table/cursor into Destroy method.
- Typo in the ControlSource or RowSource of a control.
Comments
Cannot access the selected table (Error 1152)
I found that this seems to solve the problem:
Select * from < cursor > into < cursor > NOFILTER
It recreates the cursor into the current work area.