Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 4 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:

Mapinfo.runmenucommand 1705

Mapinfo.runmenucommand 1706

Mapinfo.runmenucommand 1707

Mapinfo.runmenucommand 801

Mapinfo.runmenucommand 1701

Mapinfo.runmenucommand 304

Mapinfo.runmenucommand 1708

Mapinfo.runmenucommand 1702

Mapinfo.runmenucommand 102

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

Your Answer


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.