Cannot access the selected table (Error 1152)

topic: 

The error is related to the RowSource or ControlSource of a ListBox/ComboBox.

Possible sources of this error:

  1. 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.
  2. The RowSource of the multiple Combo/ListBoxes are SQL's which create cursor with the same name. Making cursor name unique fixes the problem.
  3. 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.
  4. Typo in the ControlSource or RowSource of a control.

Comments

To address this: "The RowSource cursor for ListBox/ComboBox has been closed or recreated in another work area. "
I found that this seems to solve the problem:
Select * from < cursor > into < cursor > NOFILTER
It recreates the cursor into the current work area.