2

This is my code:

Include "MAPBASIC.DEF"
Include   "MENU.DEF"

Dim s_filename As String
s_filename = FileOpenDlg("","","TAB"," Open Table Interactive") 
Browse * From s_filename 

I want to open a file from my computer.

  • Could you provide additional details about what it is you want to do, or any errors associated with it? Your title and question within the body don't match – GISKid Aug 19 '14 at 12:45
1

First, you must open a table. FileOpenDlg() function only get full path as a string.

Second, your Browse statement is not correct, because you are putting a full path instead of a simple table name (you could extract it with PathToTableName$() function).

Dim s_FileName, s_TableName As String

s_FileName = FileOpenDlg("","","TAB"," Open Table Interactive") 
s_TableName = PathToTableName$(s_FileName)

Open Table s_FileName as s_TableName Interactive
Browse * From s_TableName

Or last two could be also

Open Table s_FileName    
Browse * From s_TableName 
  • 1
    I wouldn't use an Alias variable to hold a table name only. It's intended to point at a combination of a table and column name, like: sTableName + ".ID". So I would suggest that you change the dim to: Dim sTableName As String – Peter Horsbøll Møller Aug 20 '14 at 6:51

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.