I am integrating a MapInfo map into a form in an Access database. I am trying to find out the number of tables loaded but NumTables() and MapperInfo() are both getting "unrecognized command" errors.
Is there another way to get the number of tables?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
You have to use Mapinfo.Eval and MapInfo.Do and wrap the other requests. You can't simply call MapBasic functions in Integrated mapping, you need to do them through these two methods, if I remember correctly.
So, something like this:
If mapinfo.Eval("TableInfo(" & tabName & "," & 5 & ")") = "F" Then MsgBox "Cannot open table!" mapinfo.Do "Close Table " & tabName
So use eval when extracting info:
MsgBox("Num tables : " + str$(Mapinfo.Eval(NumTables())))
Or something like that.
And MapInfo.Do for executing a command:
Mapinfo.Do "Close Table " & tabName
Also, you can run menu commands in integrated mapping thus:
"zoomin": Mapinfo.runmenucommand 1705 "zoomout": Mapinfo.runmenucommand 1706 "info": Mapinfo.runmenucommand 1707 "layerctrl": Mapinfo.runmenucommand 801 "select": Mapinfo.runmenucommand 1701 "deselect": Mapinfo.runmenucommand 304 "label": Mapinfo.runmenucommand 1708 "grabber": Mapinfo.runmenucommand 1702 "open": Mapinfo.runmenucommand 102 "save": Mapinfo.runmenucommand 109
Again, untested code and from the memory banks of many years ago when I worked there on MapBasic projects.