I am trying to prompt the Table name from the opened tables and to use it in the rest of the program, but what i get is (Table (i) is not open) after clicking ok the Sub Procedure is below, please help

Sub Selection

Dim num_open_Tabs, Ix  As Integer    
Dim Tab_names(50) As string
Dim Sector_table as string
Dim Sector_Table_Name as String 
Dim sector_Table_Obj as Object

Win_ID = FrontWindow()
num_open_Tabs = NumTables() 'Create Array of the Layers Names

Redim Tab_Names(num_open_Tabs)  
For Ix = 1 to num_open_Tabs
   Tab_names(ix) = TableINFO(Ix, Tab_INFO_NAME)

Dialog 'Prompt the wanted Layer name
   Title "Choose Cell_Data Table"
   Control StaticText    
      Position 10,10 Width 250 Height 10
      ID 1
      Title "Please Choose The Table Containing Your Sector Info"    

   Control popupmenu
      Title From Variable Tab_names
      Position 10,20 Width 250 Height 15
      Id 2
      Value Sector_table    
      Into Sector_table
   Control StaticText
      Position 10,50 
      Title "Enter Buffer Width"

   Control EditText
      Position 10, 60
      Value "200"
      Into Sel_Width
   Control OKButton
   Control CancelButton

If CommandInfo (CMD_INFO_DLG_OK) then
   Sector_Table_Name = TableInfo(Sector_Table, TAB_INFO_NAME)
   Exit Sub
End If

Change this dim:

Dim Sector_table as string


Dim Sector_table as Integer

Also you can get to the name of the table using the array of tables that you already have created:

Sector_Table_Name = Tab_names(Sector_Table)

And a final suggestion is not to use Selection as a name of a procedure. Selection is the name of the current selection and this might confuse your application at some stage - or yourself.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.