Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
Thanks! I'd forgotten about Eval! –  Mr_Chimp Feb 20 '12 at 12:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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