Dear all, thanks for your help on this, here is a belated summary...
Special thanks to Barry Mizen, Russell Lawley, Mircea Baila, David Haycroft, Dan Page, Caroline Hilton, and Carol Sheehan. Original help request - I was looking for some pointers on how to link up a MapInfo Table with an Access table so that when a user clicks on a MapInfo feature in a map, the info box displays attribute information from both tables, based on a common column key. All the replies are below. I went for the simple option of open Table, choose Access Database option, and open the appropriate database, choosing the table you want from the list. Then I used SQL Select to join this table to my MapInfo table, adding only the columns I needed. I saved this in my workspace so that this was opened and set up everytime the workspace was opened. This process created a *.TAB file for the Access database table I opened, and by adding 'ReadOnly' to this, the user cannot then save changes to the Access database from MapInfo. Cheers Karen ------------------------------------------------------------------------- Hi Karen, I am preparing a training course for one of our customers, to do just what you require. Try this; Open your Access table in MapInfo Create a join between your MapInfo table and your Access table, click on "Query" "SQL select". Select your two tables. Next, click on the Where condition box, and select the two linking columns with a =(MapInfo.Column = Access.Column) Give the query a name. hit OK. Then add the new table to your map using the layer control. When you click on the polygon with the info tool, you get the fields you want. refine your query to select only the columns you want instead of * You can save your query into the workspace, so youwant have to run it again. hope this helps a bit. regards Barry ____________________________________________ Barry Mizen GIS Developer Graphical Data Capture Ltd Royex House Aldermanbury Square London EC2V 7HR Phone: 020 7246 1333 Fax: 020 7246 1334 Email: [EMAIL PROTECTED] Web: http://www.graphdata.co.uk -------------------------------------------------------------------------- Dear Karen, You have to do the following: 1. Open your Access tables in MapInfo - File > Open Table - from the "Files of Type" pick "Microsoft Access Database" - choose your database - in the "Open Access Table" choose the table you want - repeat the above steps for the other table 2. Join the polygon tables with your Access tables (opened at point 1) using the common fields you mentioned - Table > Update Column - from the "Table to Update" pick your polygon table - from the "Get Value From Table" pick the first Access table you opened in Mapinfo - the "Column to Update" will change automatically to "Add new temporary column" - click the "Join" button - where the common field from the polygon table matches the common field from your Access table - at "Calculate" pick (leave) "Value" - at "of:" choose the columns from youe Access table you would like to add to the polygon - OK - repeat the above steps for the second table you would like to join - save your workspace, so that next time you will open MapInfo the above operation will be performed automatically I hope this is of help. Regards, Mircea Baila MobiFon, Romania E-mail: [EMAIL PROTECTED] Web: www.connex.ro --------------------------------------------------------------------------- Karen It is the case that MapInfo can "expose" Microsoft Access tables as though they were native tables. You can therefore the capabilities that you want with no programming, just WOR files. These capabilities are: * click with the Info tool on a map feature and display info from an Access table * opionally make the Access table read-only The basic steps are: 1. using MapInfo create a "link" table that exposes an Access Table to MapInfo (the link is stored as a TAB file and an AID file in the same folder as the Access MDB) 2. create an SQL query to join a MapInfo table to the linked Access table and save the query template (the result from this query is mappable) 3. open the query result in a map 4. add background map layers 5. save the workspace You can then use the Info tool to see stuff from the Access table- see image1.gif Look at image2.gif to see browser views of the MapInfo table (PersMap) the linked read-write Access table (PersRW) and the query to produce the mappable result set (Persons) To make the Access table read-only, you can edit the TAB file for the linked table and insert the statement ReadOnly, like this: !table !version 410 !charset WindowsLatin1 Definition Table File "kp1.mdb" Type ACCESS TABLE "PersonDet" Charset "WindowsLatin1" Fields 5 persID Char (5) ; persName Char (20) ; persAgeYear Smallint ; persHeightM Float ; persWeightKg Smallint ; ReadOnly Attached is a zip file containing sample Mapinfo tables, Access 97 MDB, linked tables and ReadWrite and ReadOnly workspaces. If you have Access 97 installed you should be able to try these samples. Just unzip to c:\temp and open KP.WOR. Regards David M Haycraft Information Analysis Associates Pty Ltd ABN 47 085 516 105 1 Cumming Place, Wanniassa, 2903 Aust Capital Territory, Australia Phone/Fax: 61 + 2 + 6231 8104 Mobile: 0412 001 134 Email: [EMAIL PROTECTED] Web : www.acslink.aone.net.au/actaa/iaa.htm A MapInfo Technology Partner ---------------------------------------------------------------------------- - I'm also interested in discovering how to link Access to Mapinfo so that when you click on an object it will open other related or linked databases in Access. I know you can view Access table in Mapinfo, however since MapInfo does not show any memo fields I would like this information to be viewed through Access somehow. I've heard of a program called GeoBasemap MapLinker, by a company called Exa-Min. It allows you to link to other programs such as Access. Therefore, you can click on a map object and have the Access form which corresponds to the object pop up. I haven't tried this yet but you can check them out at http://www.geobasemap.com/index.html . If you come up with any other solutions I would be much appreciated if you could forward them my way also. Thanks! Dan Pagé Parks Canada [EMAIL PROTECTED] ------------------------------------------------------------------------- Hi Karen There is an add-on program which will do exactly this for you. It links from MI to any other software through a common ID code, and as your data is coded already you would be perfectly set up to use it. The software is called MapLinker, and was developed in Australia. I can send you a 30-day evaluation if you are interested, but for more info you should look at the MapLinker page of our website (www.pelicangeographics.co.uk). Some people will probably suggest that you could do some DDE programming to link to your Access fields, but this software saves you the programming and also makes it simple to link from Access (or other software) back to your GIS. One click on the map object will open the relevant access form or table, or will open Word documents at specific bookmarks, or digital images, etc. The software is not expensive, at £410 + VAT, and as I mentioned will save you a lot of programming time. Please let me know if you'd like an evaluation and some more info regards Caroline .................................. Dr Caroline Hilton Pelican GeoGraphics Ltd 35c Martell Road London, SE21 8ED UK Tel: +44 (0)20 8473 2349 Fax: +44 (0)70 9221 2918 [EMAIL PROTECTED] www.pelicangeographics.co.uk ---------------------------------------------------------------------------- - Karen, Here is a response I sent out to another person about MapInfo/Access. I hope it is of some help to you - if you want to click on an object and then have something happen - sounds like you need a callback to your application notifying that the user clicked and then taking appropriate activity. Let me know if you have any questions about the below. Carol Sheehan ---------------------------------------------------- Hi Russell, Ok, that's the spirit, ready for a new challenge? You'll need an access form with a picturebox. This picturebox will serve as a holder for your map. You'll need to create a variable of class mapinfo.application: ----------------- dim MapInfo As Object Set MapInfo = CreateObject("mapinfo.application") ----------------- This MapInfo object can only do commands that work in the MapBasic window. MapInfo.Do "Set Next Document Parent " & MapFrame.hwnd & " Style 1" MapInfo.Do "Set Application Window " & MapFrame.hwnd The above code sets up the relationship between a MapInfo window (map window) and your MapInfo object. I've named my picturebox MapFrame. Once your map displays in the MapFrame, all interaction with the map is communication directly with MapInfo. This is something to get you started - if you are interested in more complex solutions involving callbacks after the user clicks on a map then I'll send you that as well. You can also complile an .mbx with a remotemsghandler and send it messages from visual basic. I don't do much in access but I don't see why this wouldn't work in vba. code: -------------------------------- MapInfo.Do ("run application """ & gAppPath & "\tk_proc.mbx""") Set mbx = MapInfo.mbapplications("tk_proc.mbx") Cmd = "001_" & LTrim$(str$(iTickets)) mbx.Do (Cmd) sLine = mbx.mbglobals("Line_Info$") -------------------------------- In the above, cmd is being sent to remotemsghandler. I will parse the message and if it begins with "001" then I will trap it and do what I want. tk_proc.mbx has a remotemsghandler. After the mbx has finished its activity then I can retrieve the contents of Line_Info$ (a global variable) from mbx.mbglobals. I'll have to look for your stuff on directions magazine - Let me know if you have any questions or if I can help you with anything. Good luck, Carol Sheehan ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]