Cannot access the selected table (Error 1152)

You have attempted to select a table outside the 32K work area range or are attempting to reference a file variable in a table that is not open. This error can occur under the following conditions:

  • A table or cursor that is specified for the RowSource property of a ComboBox or ListBox control is closed.

    If you want to close a table or cursor that is specified for the RowSource property of a ComboBox or ListBox control, perform either of the following actions prior to closing the table or cursor:

    • Set the RowSource property to an empty value ("").

    -OR-

    • Release the form containing the ComboBox or ListBox control.
  • A SQL SELECT statement that recreates a table or cursor that is specified by the RowSource property is issued. When the SQL SELECT statement executes, Visual FoxPro closes then opens the table.

    To avoid this error, set the RowSource property to an empty value (""), issue the SQL SELECT statement, and reset the RowSource property to its previous value.