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?


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.

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.